Profiler Broken "ImportError: cannot import name 'pkgutil'": [Includes fix]

已回答

On attempting to run the profiler in 2017.3 EAP, I get an import error:

`/home/bolster/anaconda3/bin/python /home/bolster/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/173.3188.29/helpers/profiler/run_profiler.py 127.0.0.1 44811 /home/bolster/src/EmotionAI/fletcher/__init__.py
Traceback (most recent call last):
File "/home/bolster/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/173.3188.29/helpers/profiler/run_profiler.py", line 10, in <module>
from prof_io import ProfWriter, ProfReader
File "/home/bolster/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/173.3188.29/helpers/profiler/prof_io.py", line 8, in <module>
from prof_util import ProfDaemonThread
File "/home/bolster/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/173.3188.29/helpers/profiler/prof_util.py", line 8, in <module>
from _prof_imports import pkgutil, Stats, FuncStat, Function
ImportError: cannot import name 'pkgutil'`

 

On inspection of the helpers/profiler/_prof_imports.py, there's no reference to pkgutil, and the usage of pkgutil within _prof_imports matches the stdlib pkgutil use.

 

Adding `import pkgutil` resolved the issue.

Hope this helps someone else

0

Hello! Thank you very much for the report. I've created an issue https://youtrack.jetbrains.com/issue/PY-26607, please follow it for updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

0

请先登录再写评论。