ad-m / python-anticaptcha

Client library for solve captchas with Anticaptcha.com support.
http://python-anticaptcha.readthedocs.io/en/latest/
MIT License
222 stars 51 forks source link

Newest release breaks shell imports #59

Closed dransho1 closed 4 years ago

dransho1 commented 4 years ago

Hello! It looks like the newest python-anticaptcha release breaks upon importing into a Python shell. I can confirm this for Python 2.7 (yes, hilariously past end-of-life).

$ mkvirtualenv anticaptcha

(anticaptcha) $ pip install python-anticaptcha
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting python-anticaptcha
  Using cached python_anticaptcha-0.5.0-py2.py3-none-any.whl (4.6 kB)
Collecting six
  Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting requests
  Using cached requests-2.23.0-py2.py3-none-any.whl (58 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2019.11.28-py2.py3-none-any.whl (156 kB)
     |████████████████████████████████| 156 kB 2.5 MB/s
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Using cached urllib3-1.25.8-py2.py3-none-any.whl (125 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.9-py2.py3-none-any.whl (58 kB)
     |████████████████████████████████| 58 kB 6.9 MB/s
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
     |████████████████████████████████| 133 kB 11.2 MB/s
Installing collected packages: six, certifi, urllib3, idna, chardet, requests, python-anticaptcha
Successfully installed certifi-2019.11.28 chardet-3.0.4 idna-2.9 python-anticaptcha-0.5.0 requests-2.23.0 six-1.14.0 urllib3-1.25.8

(anticaptcha) $ python
Python 2.7.16 (default, Mar  4 2019, 09:02:22)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import python_anticaptcha
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named python_anticaptcha
>>> quit()

(anticaptcha) $ pip install python-anticaptcha==0.4.2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting python-anticaptcha==0.4.2
  Using cached python_anticaptcha-0.4.2-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: six in /Users/davidranshous/.virtualenvs/anticaptcha/lib/python2.7/site-packages (from python-anticaptcha==0.4.2) (1.14.0)
Requirement already satisfied: requests in /Users/davidranshous/.virtualenvs/anticaptcha/lib/python2.7/site-packages (from python-anticaptcha==0.4.2) (2.23.0)
Requirement already satisfied: certifi>=2017.4.17 in /Users/davidranshous/.virtualenvs/anticaptcha/lib/python2.7/site-packages (from requests->python-anticaptcha==0.4.2) (2019.11.28)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/davidranshous/.virtualenvs/anticaptcha/lib/python2.7/site-packages (from requests->python-anticaptcha==0.4.2) (1.25.8)
Requirement already satisfied: idna<3,>=2.5 in /Users/davidranshous/.virtualenvs/anticaptcha/lib/python2.7/site-packages (from requests->python-anticaptcha==0.4.2) (2.9)
Requirement already satisfied: chardet<4,>=3.0.2 in /Users/davidranshous/.virtualenvs/anticaptcha/lib/python2.7/site-packages (from requests->python-anticaptcha==0.4.2) (3.0.4)
Installing collected packages: python-anticaptcha
  Attempting uninstall: python-anticaptcha
    Found existing installation: python-anticaptcha 0.5.0
    Uninstalling python-anticaptcha-0.5.0:
      Successfully uninstalled python-anticaptcha-0.5.0
Successfully installed python-anticaptcha-0.4.2

(anticaptcha) $ python
Python 2.7.16 (default, Mar  4 2019, 09:02:22)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import python_anticaptcha
>>>

My team noticed this happening this morning after the release of version 0.5.0. Pinning to v0.4.2 works fine.

ad-m commented 4 years ago

I am able to reproduce:

docker run python:2.7 bash -c 'pip install python_anticaptcha; python -m "import python_anticaptcha";'

I will release patch release today.

riccardolunardi commented 4 years ago

I have the same problem, but on Python3 and on scripts, not on shell. I tried your example of the new hCaptcha.

Traceback (most recent call last):
  File "ex_hcapt.py", line 5, in <module>
    from python_anticaptcha import AnticaptchaClient, HCaptchaTaskProxyless
ModuleNotFoundError: No module named 'python_anticaptcha'

Is it related to this or it's an error by my side? Because with the 0.4.2 version it seems to be imported

ad-m commented 4 years ago

It's related to this.

ad-m commented 4 years ago

Fixed in v0.5.1.

$ docker run python:2.7 bash -c 'pip install python_anticaptcha==0.5.1; python -c "import python_anticaptcha";' 
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting python_anticaptcha==0.5.1
  Downloading python_anticaptcha-0.5.1-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: six in /usr/local/lib/python2.7/site-packages (from python_anticaptcha==0.5.1) (1.14.0)
Collecting requests
  Downloading requests-2.23.0-py2.py3-none-any.whl (58 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2019.11.28-py2.py3-none-any.whl (156 kB)
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1
  Downloading urllib3-1.25.8-py2.py3-none-any.whl (125 kB)
Collecting idna<3,>=2.5
  Downloading idna-2.9-py2.py3-none-any.whl (58 kB)
Collecting chardet<4,>=3.0.2
  Downloading chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Installing collected packages: certifi, urllib3, idna, chardet, requests, python-anticaptcha
Successfully installed certifi-2019.11.28 chardet-3.0.4 idna-2.9 python-anticaptcha-0.5.1 requests-2.23.0 urllib3-1.25.8