Closed navan0 closed 5 years ago
Thanks for reporting this. I normally test with Python 2.7.10 and 3.7. I downloaded Python 3.6.8 and tried that but didn't see an issue.
Please paste the output from $ python3 --version into this bug so that we can see the specific 3.6 version and which platform this is happening on.
Also, consider trying Python 3.7 to see if the problem happens in that version.
It's python 3.6.7
Do we need profiling of programs for regular users at all? Maybe add some flag like "--dev" to enable profiling?
@gennad, sounds good. I'm a bit concerned that the Python install on @Navan0 's machine is damaged(?). While @gennad is correct about not needing this code, it should still work without crashing afaik.
hmm i will reinstall and check
I thought I had this problem. Then I realised it's because I had created a script called profile.py
to run the profile! (This causes AttributeError: module 'cProfile' has no attribute 'run'
). Hope that helps!
Good to know!
Where was the profile.py created? (Was it in the ci_edit directory - with the ci.py file?)
It was in the current working directory - the profile.py script was the script I was actually running which did some setup and called the module which had the function I wanted to profile. Just a classic case of don't give your script the same name as a Python package in your path... Now I renamed it speedtest.py
.
Thanks again. Since it's been awhile since Navan0's report and the description from billtubbs seems reasonable, I'll close this (assigned to billtubbs to credit billtubbs).
import cProfile to run
it has run attribute
import cProfile import re
for i in range(5): print(pr.calibrate(10000)) a=cProfile.run('re.compile("Hello")') print(a)
Traceback (most recent call last): File "/usr/local/bin/y", line 35, in
import app.ci_program
File "/opt/ci_edit/app/ci_program.py", line 24, in
import cProfile
File "/usr/lib/python3.6/cProfile.py", line 22, in
run.doc = _pyprofile.run.doc
AttributeError: module 'profile' has no attribute 'run'