首页 > 解决方案 > 使用 Cron 作业的 Python 脚本未将输出保存到 Google VM 实例中的文件

问题描述

我正在尝试使用 Cron 作业在我的 Google VM 实例中运行 python 脚本。

    ... #scrape the website
    print("checkpoint")
    if not (os.path.isdir(path)):
        os.makedirs(path)
    if not (os.path.isfile(path + file)):
        data_new.to_csv(path+file, index = False)
    else:
        data = pd.read_csv(path+file)
        data = data.append(data_new)
        data.to_csv(path+file, index = False)
    print("done")

在此处输入图像描述

已经提出了许多其他类似的问题,但没有帮助,例如12

我不知道还有什么导致这个问题,更不用说解决了。

标签: pythongoogle-cloud-platformcrongoogle-compute-engine

解决方案


推荐阅读