python - Python 脚本不会在任务计划程序上运行
问题描述
我正在尝试让 python 脚本在任务调度程序上自动运行。
我从谷歌搜索中尝试了几个修复程序,但都没有奏效。
我当前的操作设置如下:
我尝试了几种不同的操作设置组合,包括将脚本名称放入参数等。这些都没有奏效。
然后我在脚本中添加了一个代码,看看它有多远:
import logging, os
logpath = os.path.dirname(__file__)
logging.basicConfig(filename= logpath +'\\' +'logfile.log',level=logging.DEBUG,format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p')
logging.info("The script was here")
该脚本一直运行,直到它必须连接到 SQL 服务器:
cnxn = pyodbc.connect("Driver={SQL Server Native Client 11.0};"
"Server=dmadb;"
"Database=db_DMA_MIDW_INS;"
"Trusted_Connection=yes;")
有任何想法吗?
谢谢!
解决方案
推荐阅读
- jquery - 语法错误,无法识别的表达式:jquery.magnific-popup
- reactjs - 在网络选项卡中看不到 GraphQL 请求 - 反应原生
- python - 从线程外部在 Python 中发送 websocket 消息
- python - 在treeview python中标记特定值(列)以对其进行着色
- vue.js - Vue bootstrap-vue安装后抛出错误
- python - multiprocessing.queue.get() 上的异步 IO 切换协程未准备好
- sql-server - “当不存在数据时尝试读取无效。”,但“hasrows”为真
- java - java中的易失或同步
- laravel - 在 laravel + Vuejs 中缓存或保存 api 响应数据的理想方法是什么?
- react-native - 表单验证 React Native