I have started to use pycharm and i can't seem to
in the command line i use to run the program in this way:
python parse_file.py < test.txt
when parse_file.py can be simple as :
import sys
for line in sys.stdin:
print line
i cant find in the configuration where to do it i tried typeing something like <test.txt
in the script parameters but no luck
I have looked at https://www.jetbrains.com/pycharm/help/run-debug-configuration-python.html
but no luck there also
Thanks
PyCharm's run configurations do not support standard input redirection. Please consider changing your script so that it reads its input from a file directly, and not through the standard input redirection.
There is solution, but it is not portable and you will have to adapt it to you OS. I describe it for Windows.
cmd.exe
. In Parameters, type /c "$JDKPath$ parse_file.py < test.txt"
(Double quotes are important) and configure the Working directory to the folder where your files are stored.Now, you can right click on a file in your project, and select "External Tool > cmd input redirected".
The only annoying thing with that process is you will not be able to rerun the external tool with a shortcut while editing your code. To rerun, you have to set the focus on 'Run' tab, then use Ctrl + F5 (or simply click on the green triangle Rerun 'cmd input redirected'
Hope this help, regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With