Reputation: 181
I have a short python script that uses the logging module and the configparser module. I use PyCharm 2.7.1 and Python 3.3 under Win7.
When I run my script using PyCharm - it works. This is the output from the PyCharm console:
C:\Python33\python.exe C:/some/path/script.py
Process finished with exit code 0
I run the same command in the cmd and this is what I get:
C:\>C:\Python33\python.exe C:/some/path/script.py
Traceback (most recent call last):
File "C:/some/path/script.py", line 10
1, in <module>
initLogger()
File "C:/some/path/script.py", line 97, in initLogger
logging.config.fileConfig('RecorderMoverLog.config.ini')
File "C:\Python33\lib\logging\config.py", line 70, in fileConfig
formatters = _create_formatters(cp)
File "C:\Python33\lib\logging\config.py", line 103, in _create_formatters
flist = cp["formatters"]["keys"]
File "C:\Python33\lib\configparser.py", line 942, in __getitem__
raise KeyError(key)
KeyError: 'formatters'
Why does it run in PyCharm and won't run under python shell?
Thanks
Upvotes: 1
Views: 1593
Reputation: 1236
It is most likely because of your PYTHON_PATH
. List sys.path
in your Python IDE and in your Python in shell. Look for the difference in the Python libraries.
Upvotes: 2