【发布时间】:2021-11-13 18:19:46
【问题描述】:
我得到一个
No such file or directory: 'SnP1000_TICKR.csv' 错误,但我所有的文件都在以下文件夹中:
我在这里调用文件
在这段代码上运行的:
def finVizEngine(input,output):
import chromedriver_autoinstaller
chromedriver_autoinstaller.install() # Check if the current version of chromedriver exists
# and if it doesn't exist, download it automatically,
# then add chromedriver to path
driver = webdriver.Chrome()
ipo_df = pd.DataFrame({})
openFinViz()
with open(input, 'r') as IPO_List:
csv_reader = reader(IPO_List)
这是以前运行的,但后来我将文件上传到 Github 并开始从 vscode 而不是 pycharm 运行文件,并开始出现大量错误,但老实说不明白出了什么问题。任何帮助都会很棒,
最好的乔奥
【问题讨论】:
-
Python 不在乎脚本是什么目录。 Python 只关心你的current working directory,这可能是你项目的根。
-
您如何准确地运行您的脚本?例如。 VS Code 调试器,VS Code 集成终端?
-
您可能需要使用
finVizEngine('Scripts/SnP1000_TICKR.csv, SnP1000_DATA.csv),因为SNP1000是您的基础项目文件夹 -
同时命名变量
input是一种不好的做法,因为它是内置函数的名称。 -
总是将代码、数据和完整的错误消息作为文本(不是截图,不是链接)放在有问题的地方(不在评论中)。
标签: python selenium directory path