Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start a console in newly installed Pycharm in Windows

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"-------------

like image 203
Youngsup Kim Avatar asked Mar 22 '15 07:03

Youngsup Kim


2 Answers

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.

like image 93
uday Avatar answered Sep 28 '22 17:09

uday


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.

like image 44
wyleu Avatar answered Sep 28 '22 15:09

wyleu