Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

pkg_resources is depreciated. #22

Open
jamesrusso opened this issue Feb 10, 2024 · 8 comments · May be fixed by #24 or #32
Open

pkg_resources is depreciated. #22

jamesrusso opened this issue Feb 10, 2024 · 8 comments · May be fixed by #24 or #32

Comments

@jamesrusso
Copy link

>>> import pkg_resources
<stdin>:1: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
>>> 

This is used here:

def from_file(name):
    """Read script from ./js directory"""
    return pkg_resources.resource_string('playwright_stealth', f'js/{name}').decode()

In 3.12.0 I was getting pkg_resources not found, so perhaps setuptools needs to be a dependency?

@paveldudka paveldudka linked a pull request Mar 7, 2024 that will close this issue
@Fitmavincent
Copy link

Currently experiencing ModuleNotFoundError: No module named 'pkg_resources' issue when running stealth()

@Yangeok
Copy link

Yangeok commented Apr 18, 2024

Same issue

@wadeedmadni
Copy link

Same Issue
ModuleNotFoundError: No module named 'pkg_resources'

Any solutions?

@Hime-Hina
Copy link

Using importlib.resources.

import importlib.resources


def from_file(name: str):
    """Read script from ./js directory"""
    return (
        importlib.resources.files("playwright_stealth").joinpath("js", name).read_text()
    )

@cydan33
Copy link

cydan33 commented Jul 23, 2024

I'm having the same issue... Will the paveldudka PR be pushed one day?

@LumaC0
Copy link

LumaC0 commented Aug 13, 2024

I've run into this issue a few times, the solution being pip install setuptools

@bluenote10
Copy link

Note that installing setuptools is also more of a temporary work-around, and not a very sustainable solution. As per the setuptools docs:

image

Fortunately, the usage of pgk_resources is unnecessary in this case, because accessing relative files is much easier and reliable by using __file__. So #32 is the way to go in my opinion (#24 does the same, but unnecessarily reformats the file).

@AtuboDad It would be great if #32 could be merged and released to PyPI.

@paveldudka
Copy link

Looks like this repo is no longer maintained.
We ended up forking it and take over maintenance

https://github.com/tinyfish-io/tf-playwright-stealth
New artifact can be installed via:

pip install tf-playwright-stealth

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
9 participants