8

On Windows 7 machine, Pycharm (community or professional) and Python 3.4 (tried Anaconda 3 as well) were installed newly. There were not problems running Python scripts interactively in main editor. However, when I tried to select View > Tool Windows > Python Console, it generates the following error messages and more. Basically, I couldn't bring up a console window in Pycharm.

C:\Users\user\Anaconda3\python.exe -u C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevconsole.py 56743 56744
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydev_imports.py", line 21, in <module>
    from SimpleXMLRPCServer import SimpleXMLRPCServer
ImportError: No module named 'SimpleXMLRPCServer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm     4.0.5\helpers\pydev\pydevconsole.py", line 20, in <module>
    import pydevd_vars
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd_vars.py", line 9, in <module>
    from pydevd_xml import *
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd_xml.py", line 7, in <module>
    from pydev_imports import quote
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydev_imports.py", line 23, in <module>
    from xmlrpc.server import SimpleXMLRPCServer
  File "C:\Users\user\Anaconda3\lib\xmlrpc\server.py", line 108, in <module>
    from http.server import BaseHTTPRequestHandler
  File "C:\Users\user\Anaconda3\lib\http\server.py", line 660, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
  File "C:\Users\user\Anaconda3\lib\http\server.py", line 851, in SimpleHTTPRequestHandler
    mimetypes.init() # try to read system mime.types
  File "C:\Users\user\Anaconda3\lib\mimetypes.py", line 348, in init
    db.read_windows_registry()
  File "C:\Users\user\Anaconda3\lib\mimetypes.py", line 255, in read_windows_registry
    with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: OpenKey() argument 2 must be str without null characters or None, not str

Process finished with exit code 1
Couldn't connect to console process.

-----------------these messages were showed up in "Python Console"-------------

Youngsup Kim
  • 2,235
  • 5
  • 13
  • 18
  • Is there anything else in the stacktrace? Looks like it's truncated where you put in the ... – yole Mar 22 '15 at 08:40
  • I tried the latest version of Python 3.4.2 and also tried the latest Anaconda download. Tried Community or Professional version of Pycharm as well. I added the entire error message shown in "Python Console". Thanx! yskim. – Youngsup Kim Mar 22 '15 at 09:55
  • Have you read e.g. http://stackoverflow.com/q/2384064/3001761? – jonrsharpe Mar 22 '15 at 11:00
  • Hi jonrsharpe, I installed PyWin32, tried it with Python34(not Anaconda). But, PyCharm could not start the console and produced the same error messages. Thanks your suggestion though. (a debtor)<> – Youngsup Kim Mar 23 '15 at 04:04

4 Answers4

7

You need to change your working directory. Go to File->Settings->Build, Execution, Deployment->Console->Python Console and then change or provide a directory where you have read and write access in the Working directory box.

uday
  • 6,453
  • 13
  • 56
  • 94
2

The configuring of pycharm in the presence of various development configurations is a bit of a black art IMHO. The most effective mechanism I've found for pinning this down is put random strings into the various settings dialogs, Interpreters, consoles, tests , servers and observe the command lines submitted to the interpreter VERY carefully. Hardly a satisfactory approach but it will sort out what is going where and to a certain degree what effects what.

The other think that helps me are screenshots of the settings and testing dialogs of working installations.

Again, a bit rough and ready but it has got me up and running again after a long period of successful debugging followed by pycharm amnesia.

wyleu
  • 59
  • 4
  • Thank you for your suggestion. A couple of days ago, the same problem happened in my desktop. Then, I realized that it was caused by others.... virus, adware etc. I removed all S/W I installed recently one by one until it worked!!! The last S/W I removed was YAC (Yet another cleaner). However I did the same on my notebook. It did not work. Today, I reformatted the notebook finally. Later, I heard a similar story from one of my students. At this point I am not sure that YAC was a culprit. Maybe we need to find more similar cases to investigate further. (a debtor)<> – Youngsup Kim Mar 26 '15 at 11:50
0

I had same problem. I reinstalled python and default directories have changed.

Then I just refreshed interpreter here File->Settings->Build, Execution, Deployment->Console->Python Console and here File->Settings->Project: <YOUR_PROJECT>->Project Interpreter.

If you will open new projects interpreter will need choose again (?)

Jackssn
  • 1,346
  • 1
  • 14
  • 16
0

I got it resolved by setting the interpreter in Preferences and project interpreter.

Olive.b
  • 93
  • 4