[英]How to Run Python on Komodo IDE that read from text file?
I am using Komodo IDE and have a python file that reads text from a text file, does calculations, then outputs to the console. 我正在使用Komodo IDE,并且有一个python文件,该文件从文本文件读取文本,进行计算,然后输出到控制台。 I am using a command to run the file, with the phrase %(python3) -u "%F
in the command part. 我正在使用命令来运行文件,在命令部分中使用短语%(python3) -u "%F
。
When I run this file in debugger, it works fine, but when I run it using the command to output to Command Output, this error pops up: 当我在调试器中运行此文件时,它可以正常工作,但是当我使用命令运行该文件以输出到命令输出时,将弹出此错误:
Traceback (most recent call last): File "C:\\Users\\Haseeb\\Desktop\\Saud\\A School Work\\Z-Computer Programming\\ECOO Practice\\2010Problem1.py", line 1, in <module> f = open('2010DATA.txt', 'r') FileNotFoundError: [Errno 2] No such file or directory: '2010DATA.txt'
This command runs other programs, just not ones that read from text files. 该命令运行其他程序,而不是从文本文件读取的程序。 Here is a picture of the code, command and and error. 这是代码,命令和错误的图片。
Any help would be highly appreciated. 任何帮助将不胜感激。
您需要将“开始于”目录设置为执行命令的目录,或者避免使用相对路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.