pycharm 2019.1.3 professional debugger bug

Answered

I did nothing to it and it just raist this error and could not debug again:

/home/xuanqi/workspace/github/foolcage/zvt/ve/bin/python /home/xuanqi/software/pycharm-2019.1.3/helpers/pydev/pydevd.py --multiproc --save-signatures --qt-support=auto --client 127.0.0.1 --port 37306 --file /home/xuanqi/workspace/github/foolcage/zvt/zvt/test_dash.py
Traceback (most recent call last):
File "/home/xuanqi/software/pycharm-2019.1.3/helpers/pydev/pydevd.py", line 15, in <module>
from _pydevd_bundle.pydevd_constants import IS_JYTH_LESS25, IS_PY34_OR_GREATER, IS_PY36_OR_GREATER, IS_PYCHARM, get_thread_id, \
File "/home/xuanqi/software/pycharm-2019.1.3/helpers/pydev/_pydevd_bundle/pydevd_constants.py", line 169, in <module>
from _pydev_imps._pydev_saved_modules import thread
File "/home/xuanqi/software/pycharm-2019.1.3/helpers/pydev/_pydev_imps/_pydev_saved_modules.py", line 22, in <module>
import xmlrpc.server as _pydev_SimpleXMLRPCServer
File "/usr/lib/python3.6/xmlrpc/server.py", line 108, in <module>
from http.server import BaseHTTPRequestHandler
File "/usr/lib/python3.6/http/server.py", line 100, in <module>
import socketserver
File "/usr/lib/python3.6/socketserver.py", line 154, in <module>
_ServerSelector = selectors.SelectSelector
AttributeError: module 'selectors' has no attribute 'SelectSelector' 

 

It seems pycharm make the PYTHONPATH confused, I have one module 'selectors' in my project and it should be zvt.selectors...

I add SelectSelector(en ampty class) to my zvt.selectors module and the debugger error not happen...but of course it could do nothing

So I confirm it should be that..pycharm make the PYTHONPATH confused

 

Thanks for your support!

0
11 comments

It seems pycharm add wrong working dir to PYTHONPATH...I could fix it manually

0

Hi,

Would it be possible to provide some screenshots demonstrating the issue?

PyCharm appends your working directory to sys.path. There are only two options in the Run/Debug configuration which change PYTHONPATH.

 

0

1)default settings and it could run but debug error

because my 'selectors' module in my project overlay the system selectors...in fact,my project module should be zvt.selectors

 

2)I changed the settings and it could run and debug well

 

I think adding '/home/xuanqi/workspace/github/foolcage/zvt' to working dir is right...but it seems pycharm add '/home/xuanqi/workspace/github/foolcage/zvt/zvt' by default...and it could run well and debug failed sometimes...

1

PyCharm sets the working directory according to the script location. Your main.py file is located in .../foolcage/zvt/zvt, right?
I don't think PyCharm can somehow discover that there is a conflict with the system module and change the working directory accordingly.

0

"PyCharm sets the working directory according to the script location" this's the right behavior

Running/Debugging script in any module of the project, pycharm should add the same project root module to the working dir by default?

I check it and it is ".../foolcage/zvt/zvt"

but the behavior of 'run' and 'debug' is different...one could work and one could not.

for debug,I set it to ".../foolcage/zvt" and it works.

i think it's easy to reproduce the issue...

 

0

Would it be possible to share this project or its relevant part for reproducing?
I tried to reproduce it on my side, but perhaps there are some differences.

You can zip it and upload to https://uploads.services.jetbrains.com/, just let me know the name of the file.

0

@Sergey Karpov

please check zvt.tar.gz, you could run and debug the main.py in pycharm.

 

0
I knew that pycharm add the running script dir to sys.path automaticlly

add following would fix all the confuses:

import os
import sys

sys.path.remove(os.path.abspath(os.path.dirname(__file__)))
0

Sorry, I couldn't find it on our FTP server. Could you please upload it once again?

You should see similar message:

0
Uploading...
File uploaded: zvt.tar.gz
Upload complete!

@Sergey Karpov It's should be ok now

0

Thank you!
I filed an issue to our tracker https://youtrack.jetbrains.com/issue/PY-37444, feel free to vote and leave comments.

0

Please sign in to leave a comment.