PyCharm and http.client

Am I just having some peculiar troubles with my platform or is PyCharm having problems to "import client.http"? I am using OSX 10.6.7, have Python 3.1.2 installed (MacPython), and use PyCharm 1.5.1. If I try the following code, PyCharm's inspection and all other code-intelligence functionality breaks:

from http import client


# now do something, eg:

try:

     raise client.HTTPException("funny")

except client.HTTPException as err:

     pass

I get a ton of problems and errors if I try this. If I drop into the http/client.py module, I also see PyCharm is having hickups at a silly print line (380) with the following statement:

print("header:", hdr, end=" ")

Saying something about "end of statement expected" and giving me a red alert (upper right corner)... I assume this is somehow interfering with PyCharm's capabilities of doing its code-intelligence stuff, at least for me. Can anybody else confirm this or has some explanation what might be happening? It is anoying to have to turn off all inspection for everything related to http.client usage and some help would be much appreciated. To be more informative, here are the MD5s of my http/client.py module:

MD5 (/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/http/client.py) = 2bd8f9b3f731b2c0842521001bf69dc6

MD5 (/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/http/client.pyc) = 286a57394b2ae508ded68d849002b11a

MD5 (/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/http/client.pyo) = c427d9e7672c0b5080d8d840bebf8240

Thanks!

2 comments

Hello Florian,

Does the problem still happen if you remove the Python 3.1.2 interpreter

in Settings | Python Interpreters, then restart PyCharm and add the interpreter

back?

Am I just having some peculiar troubles with my platform or is PyCharm

having problems to "import client.http"? I am using OSX 10.6.7, have

Python 3.1.2 installed (MacPython), and use PyCharm 1.5.1. If I try

the following code, PyCharm's inspection and all other

code-intelligence functionality breaks:

from http import client

  1. now do something, eg:

try:

raise client.HTTPException("funny")

except client.HTTPException as err:

pass

I get a ton of problems and errors if I try this. If I drop into the

http/client.py module, I also see PyCharm is having hickups at a silly

print line (380) with the following statement:

print("header:", hdr, end=" ")

Saying something about "end of statement expected" and giving me a red

alert (upper right corner)... I assume this is somehow interfering

with PyCharm's capabilities of doing its code-intelligence stuff, at

least for me. Can anybody else confirm this or has some explanation

what might be happening? It is anoying to have to turn off all

inspection for everything related to http.client usage and some help

would be much appreciated. To be more informative, here are the MD5s

of my http/client.py module:

MD5

(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/http/

client.py) = 2bd8f9b3f731b2c0842521001bf69dc6

MD5

(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/http/

client.pyc) = 286a57394b2ae508ded68d849002b11a

MD5

(/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/http/

client.pyo) = c427d9e7672c0b5080d8d840bebf8240

Thanks!

---

Original message URL:

http://devnet.jetbrains.net/message/5306333#5306333

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0

Yes, I remove all interpreters from a Project, press Apply, close the Preferences window, open it again, and add Python 3.1 back in. Then I try the above again (import http.client, etc.), and still PyCharm introspection fails and looking at the code PyCharm thinks that the http.client code has an error in line 380... (Which, btw, is clearly not the case; If I make sure I use that statement by using a HTTPConnection with debuglevel > 0, everything runs as fine as ever.)

0

Please sign in to leave a comment.