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

Startup error in parse_noproxy() #139

Closed
DK100 opened this issue Apr 20, 2022 · 2 comments
Closed

Startup error in parse_noproxy() #139

DK100 opened this issue Apr 20, 2022 · 2 comments

Comments

@DK100
Copy link

DK100 commented Apr 20, 2022

Hi! I just upgraded from version 0.4 to the current one and I get the following error on startup (using the same px.ini file as before):

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "...\px.py", line 1652, in <module>
    main()
    ^^^^^^
  File "...\px.py", line 1647, in main
    parse_config()
    ^^^^^^^^^^^^^^
  File "...\px.py", line 1450, in parse_config
    State.wproxy = wproxy.Wproxy(wproxy.MODE_CONFIG_PAC, [pac], debug_print = dprint)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\wproxy.py", line 323, in __init__
    super().__init__(mode, servers, noproxy, debug_print)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\wproxy.py", line 132, in __init__
    noproxy, self.noproxy_hosts = parse_noproxy(noproxy)
                                  ^^^^^^^^^^^^^^^^^^^^^^
  File "...\wproxy.py", line 78, in parse_noproxy
    bypasses = [h for h in noproxystr.lower().replace(' ', ',').replace(';', ',').split(',')]
                           ^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'lower'

My ini-file looks like this:

[proxy]
server = 
pac = http://localhost:4444/proxy.pac
port = 3128
listen = 127.0.0.1
allow = *.*.*.*
gateway = 0
hostonly = 0
noproxy = 
useragent = 
username = 
auth = 

[settings]
workers = 2
threads = 5
idle = 30
socktimeout = 20.0
proxyreload = 60
foreground = 0
log = 1

I downloaded the code and I was able to run a debug session (I'm no python coder yet ;). If I understand it correctly the error occurs when the wproxy-class is created the first time. During the initialization the parse_noproxy method will always be called with "noproxystr" = NONE...which seems to me that this should always fail (calling .lower() on NONE)?!

Another thing I'm wondering about is the mentioned line 132 in wproxy.py:
noproxy, self.noproxy_hosts = parse_noproxy(noproxy)

Shouldn't it be:
**self.**noproxy, self.noproxy_hosts = parse_noproxy(noproxy)
?

Thank you and best regards,
phil

@genotrance
Copy link
Owner

I've posted v0.6.3 with a fix - please verify and thanks for the review!

@DK100
Copy link
Author

DK100 commented May 4, 2022

It works now, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants