不能用crontab调度python脚本

您所在的位置:网站首页 nginx调度 不能用crontab调度python脚本

不能用crontab调度python脚本

2023-03-20 17:33| 来源: 网络整理| 查看: 265

I have this python script I did in anaconda and downloaded to my local workspace as .py #!/usr/bin/env python # coding: utf-8 # In[33]: #!/usr/bin/env python # # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """This example downloads a criteria performance report as a string with AWQL. To get report fields, run get_report_fields.py. The LoadFromStorage method is pulling credentials and properties from a "googleads.yaml" file. By default, it looks for this file in your home directory. For more information, see the "Caching authentication information" section of our README. """ from googleads import adwords import io import pandas as pd adwords_client = adwords.AdWordsClient.LoadFromStorage() # Initialize appropriate service. report_downloader = adwords_client.GetReportDownloader(version='v201809') # Create report query. report_query = (adwords.ReportQueryBuilder() .Select('CampaignId', 'AdGroupId', 'Id', 'Criteria', 'CriteriaType', 'FinalUrls', 'Impressions', 'Clicks', 'Cost') .From('CRITERIA_PERFORMANCE_REPORT') .Where('Status').In('ENABLED', 'PAUSED') .During('LAST_7_DAYS') .Build()) output = io.StringIO() report_downloader.DownloadReportWithAwql( report_query, 'CSV', output, skip_report_header=True, skip_column_header=False, skip_report_summary=True, include_zero_impressions=True) output.seek(0) df = pd.read_csv(output) print(df.head()) # In[44]: df.to_csv("/Users/ezerivarola/Desktop/Google_ADS_API/report1.csv",index=False) # In[ ]:

我试图用以下命令用crontab来安排它。

* * * * * /usr/local/bin/python3 /Users/ezerivarola/Desktop/Google_ADS_API/Report1_DF.py

但是,尽管我没有得到任何错误,而且在查看邮件时,我看到它正在运行,但脚本的csv文件并没有被生成。

有没有人知道它可能出了什么问题?



【本文地址】


今日新闻


推荐新闻


    CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3