0

每当我尝试运行此程序或进入此程序时,我都会收到此代码。我对 python 很陌生,几乎不知道这种语言,但我试图让这段代码连接到 SQL,并希望有任何希望语法明智,甚至尝试另一种方法。任何事情都非常感谢。

import pyodbc
conn = pyodbc.connect('DRIVER={FreeTDS};Server={********};Port=1433;Database=****;Trusted_Connection=yes;TDS_Version=7.2;')


Current thread 0x76fac010 (most recent call first):
  File "/home/pi/NData_GrabS8.py", line 42 in <module>
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 588 in execute_source
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 427 in _execute_source_ex
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 374 in _execute_file
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 155 in _cmd_Run
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 119 in handle_command
  File "/usr/lib/python3/dist-packages/thonny/shared/thonny/backend.py", line 97 in mainloop
  File "/usr/lib/python3/dist-packages/thonny/shared/backend_launcher.py", line 41 in <module>
Resetting ...
4

1 回答 1

0

我发现我试图进入的服务器只使用了 Windows 身份验证,而我使用的树莓派没有这种登录权限。相反,我不得不单独为 pi 登录。trusted_connection 是它失败的地方,在我取出它后,第一次尝试连接到它的用户 ID 和密码。如果这个答案不够清楚,请发表评论,我会尽力详细说明。

于 2021-06-16T13:28:38.943 回答