Hi All. I am currently using community version of Pycharm for Window to run Python script in making automated trade via IB TWS API. However, after 4 months of experiment, the Pycharm occasionally crashed or hang-up with unknown error. I can solve this problem by restarting window and Pycharm everyday, however, it's not so ideal for a fully automated system. Is there any alternative which is more stable and sustainable? Note my constraint is to run the script in Window OS. Thanks.
pycharm is an editor (IDE). you do not need it to run a python script. Just open up commandline in windows and type python <your script name>
why do you use pycharm to run a written script? Its run is more like used for testing some new scripts, at least for me.
'python' is not recognized as an internal or external command, operable program or batch file. Tried to run a file "main.py", but seems need to install something first?
Hello @wooderson First, try running your script within the Terminal window in PyCharm. Check the bottom of the PyCharm screen. If that works, close PyCharm and try running your script within a Windows terminal. Make sure you change directory to the project directory, and also activate the virtual environment. KH
1. VS Code 2. Visual Studio 3. Eclipse 4. vi... or emacs XD What version of PyCharm and Windows are you using? Perhaps upgrade to the latest. Mine is solid as a rock. Any idea why it's crashing?
Thanks KH. This is helpful and I find the help doc from Python.org which gives a detail guidance on this issue as well. https://docs.python.org/3/faq/windows.html#how-do-i-run-a-python-program-under-windows
The version is Pycharm Community 2021.1 on Win10. The crash is unknown. Usually after Day1 trading finish, I take log from the "run" window and close it. Then I start Day2 trading (a timer starts and runs overnight). After I wake up, the "run" window or the "code" window occasionally freeze, and certainly the timer fails to work too. Maybe I did something wrong.. Thanks for your suggestion. In your opinion, do you think Pycharm is the most reliable one out of those?
I don't think it's the IDE, PyCharm is solid and good. Something weird is going on; I suspect it's in your pipeline somewhere. Before you dump Pycharm, I think you should get to the bottom of this, before it glitches on a trade and you end up taking a nasty loss. 1. Can you try running your scripts in a simple shell or terminal window? I'd say use a Linux shell for Windows, like Git bash, cmder, putty, or cygwin. You could also use Powershell or CMD. Set up your PYTHONPATH and other environment variables, get it working in a shell, and see if the same freeze occurs. 2. What do you mean by "taking" logs? Logs are the first place you should look for clues as to what's going wrong. Are you properly writing logs, using the Python logging library, or a 3rd-party solution? You should be! At a minimum, log some regular timestamps, so you can see when it's freezing. Write lots of logs; "verbose" mode. https://docs.python.org/3/library/logging.html 3. You know that IB has an auto-logoff feature, correct? I get kicked at 12:45am every day. Maybe you have this feature enabled? You're getting disconnected, and the IB thread is getting hung up?