为什么我的 VBA 脚本不能与 Python 一起使用并正确转发“1”?
发布时间:2022-06-30 15:54:43 242
相关标签: # node.js
这是我的第一个问题,如果缺少任何相关细节,请纠正我。
对于我所在大学当前的一个项目,我们正在尝试发送一份;1英寸;通过VBA创建python脚本。由于某些原因,python脚本没有使用;1英寸;
VBA脚本:
Dim objShell As Object
Dim PythonExe, PythonScript As String
Set objShell = VBA.CreateObject("Wscript.Shell")
PythonExe = """C:\Users\sralb\anaconda3\python.exe"""
PythonScript = "C:\Users\sralb\OneDrive - Hochschule Furtwangen\Desktop\1.py 1"
objShell.Run PythonExe & PythonScript
End Sub
Python脚本:
import serial
import time
import sys
arduino = serial.Serial(port='COM6', baudrate=9600, timeout=1)
def write(x):
arduino.write(bytes(x, 'utf-8'))
time.sleep(0)
for eachArg in sys.argv:
# print(type(eachArg))
print(eachArg)
if __name__ == "__main__":
write('1')
arduino.close()
提前谢谢你
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报