Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Error when running PyFunceble in Powershell after installing with pip #127

Closed
DandelionSprout opened this issue Sep 22, 2020 · 13 comments
Closed

Comments

@DandelionSprout
Copy link
Sponsor

DandelionSprout commented Sep 22, 2020

Bug description

After successfully installing PyFunceble 3.3.3 though pip in Powershell, running PyFunceble on a file causes the following error:

PS C:\Users\imree> PyFunceble -f 'C:\Users\imree\Desktop\Skrivebordsbilder\Til filterlisteskripttesting\Til PyFunceble\TilPyFunceble.txt'


██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Traceback (most recent call last):
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\util\connection.py", line 61, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "c:\users\imree\appdata\local\programs\python\python38\lib\socket.py", line 918, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 670, in urlopen
    httplib_response = self._make_request(
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 381, in _make_request
    self._validate_conn(conn)
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 976, in _validate_conn
    conn.connect()
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\connection.py", line 308, in connect
    conn = self._new_conn()
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x000001D0995DE460>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\connectionpool.py", line 724, in urlopen
    retries = retries.increment(
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\urllib3\util\retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='pyfunceble-not-resolved', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001D0995DE460>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\imree\appdata\local\programs\python\python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\imree\appdata\local\programs\python\python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\imree\AppData\Roaming\Python\Python38\Scripts\pyfunceble.exe\__main__.py", line 7, in <module>
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\cli\__init__.py", line 1209, in tool
    raise exception
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\cli\__init__.py", line 1194, in tool
    Dispatcher(
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\cli\dispatcher.py", line 131, in __init__
    self.dispatch_file_test(
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\cli\dispatcher.py", line 170, in dispatch_file_test
    PyFunceble.output.Constructor()
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\output\constructor.py", line 92, in __init__
    self.restore()
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\output\constructor.py", line 535, in restore
    structure = self._get_structure()
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\output\constructor.py", line 449, in _get_structure
    req = PyFunceble.REQUESTS.get(
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\lookup\requests.py", line 289, in get
    result = self.session.get(url, **kwargs)
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\requests\sessions.py", line 543, in get
    return self.request('GET', url, **kwargs)
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\PyFunceble\lookup\requests.py", line 162, in send
    response = super().send(request, **kwargs)
  File "C:\Users\imree\AppData\Roaming\Python\Python38\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='pyfunceble-not-resolved', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x000001D0995DE460>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

Modifications under .PyFunceble.yaml

None that I'm aware of.

Reproduction

Steps to reproduce the behavior:

  1. Open PowerShell 7.
  2. Install PyFunceble through pip3 install --user PyFunceble or pip install --user PyFunceble
  3. Run PyFunceble -v
  4. See that that command works as intended.
  5. Run PyFunceble -f [Whichever filename]
  6. Receive the error seen above.

Expected behavior

Running PyFunceble should work.

Screenshots

N/A

Versions

OS: Windows 10 May 2020 Update + PowerShell 7.0.3
Python Version: 3.8.1
PyFunceble Version: 3.3.3

Additional context

At least pip itself seemed to work in PowerShell, in contrast to my attempts to do so in Cygwin.

I use the "Windows Terminal" app to run PowerShell 7 in.

@spirillen
Copy link
Contributor

spirillen commented Sep 22, 2020

This is urllib3 that causes the error, @funilrys is aware of that, as it happens on all non python --version 3.8.5

You can see more in #86 (comment)

@funilrys
Copy link
Owner

Better handling of this error should be implemented into PyFunceble 4.0.0. Thanks for reporting @DandelionSprout.


Note to self: Also document the "strange" (for the world) case and purpose of the pyfunceble-not-resolved (3.x) and pyfunceble-XXXXXXXXXXX.com (4.x+) domains.

@funilrys funilrys self-assigned this Dec 20, 2020
@funilrys funilrys added this to Todo in 4.0.0: Follow - Up via automation Dec 20, 2020
@funilrys funilrys moved this from Todo to High Priority in 4.0.0: Follow - Up Dec 20, 2020
@funilrys funilrys added this to the 4.0.0 milestone Dec 20, 2020
funilrys added a commit that referenced this issue Dec 23, 2020
This patch fixes #127.

Indeed, before this patch, I didn't took into consideration that an IP
range could have been given.

Contributors:
  * @spirillen
@funilrys funilrys added this to To do in Documentation via automation Jan 7, 2021
@funilrys
Copy link
Owner

@DandelionSprout is this still happening with 4.x ?

@DandelionSprout
Copy link
Sponsor Author

DandelionSprout commented May 16, 2021

Testing with the newest 4.x version through pip, along with Python 3.9.5, PyFunceble does at least run in PowerShell now. So that's a good start. 🎉

On the other hand, being able to run it, means that I see that the color codes for lines don't work in PowerShell, and that PowerShell runs 4.x at approx. 1/5th of the speed that Cygwin does.
image

@funilrys
Copy link
Owner

Hi @DandelionSprout,
That's an awesome news 🎉
I guess that it's because of the coloration if you are sure that no firewall or virus scanner is slowing down or preventing the writing to disk.

There is the --colour switch and it's cli_testing -> display_mode -> colour configuration counterpart if you want to get rid of it!

Here is what we deploy:

# Activates the coloration of stdout.
colour: True

You can alternatively write the following inside the .PyFunceble.overwrite.yaml file to permanently disable the coloration (without having to use the --colour argument everytime).

cli_testing:
    display_mode:
        colour: False

Can you test it and tell us if the speed is better without coloration ?
Thanks for the feedback and your time!

Stay safe and healthy.
Nissar

@funilrys
Copy link
Owner

@DandelionSprout can you explain how you installed it under windows (PowerShell) ? I'm looking for someone to help me close #83.

@DandelionSprout
Copy link
Sponsor Author

From what I remember:

  1. I used PowerShell 7.1.3, downloaded from Microsoft Store.
  2. I installed the GUI installer for Python 3.9 for Windows.
  3. I run pip install --user --pre PyFunceble-dev, and PyFunceble is correctly installed.
  4. Here's comes the most interesting part: Due to having refreshed my Windows 10 installation 2 months ago, pip then shows quite a few errors (circa 10) about missing PATH filepaths in Windows, including one for Python fonts.
  5. I was never able to trigger the missing font filepath warning again, and was only able to take care of adding the Python plugin filepath to PATH.
  6. It was at this point I tested it and got the results above.

@funilrys
Copy link
Owner

Closing as I'm not able to test with windows. Feel free to add feedback over time @DandelionSprout.

Thanks to everyone.

4.0.0: Follow - Up automation moved this from High Priority to Done May 29, 2021
Documentation automation moved this from To do to Done May 29, 2021
@funilrys funilrys pinned this issue Jun 29, 2021
@funilrys
Copy link
Owner

Hey @spirillen, should we document this ?

@funilrys funilrys moved this from Done to To do in Documentation Jun 29, 2021
@funilrys funilrys unpinned this issue Jun 29, 2021
@spirillen
Copy link
Contributor

In case off I would say it would be something like python on windows doesn't export to PATH, this is a know Python "Issue"

And then maybe something about if you are stocked on a windows it have been seen some performance advancement by using cygwim.

On the other hand.... it is a windows limitation, not python / PyFunceble....


If you find any of this interesting or useful throw a ticket and I'll write something up

@funilrys
Copy link
Owner

Actually, if my memory is still good, during the installation of python (in expert mode), there is a checkbox to add python to the PATH. If people don't do it, they have to later (don't know how) add it 😢 ...

I'm lost regarding Windows issues ....

@funilrys
Copy link
Owner

Let's keep this issue or @DandelionSprout comment's as a reference for everything regarding windows installation ...

@spirillen
Copy link
Contributor

PATH. If people don't do it, they have to later (don't know how) add i

In the old days it was somewhere under "This computer" -> "properties" -> "advanced"

For the more "hardcore" you would do this in the reg_DB :)

https://www.reck.dk/reload-windows-enviroment-variables-whitout-restart/ 😉

@funilrys funilrys moved this from To do to Done in Documentation Oct 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants