gpt4 book ai didi

python-3.5 - 不能腌制 : attribute lookup datetime on pywintypes failed

转载 作者:行者123 更新时间:2023-12-04 01:13:58 25 4
gpt4 key购买 nike

我正在使用 python 3.5 (32bit)、win10-64bit、OpenOPC,并且我已经下载了 pywin32 build 64bit。我已经运行了以下 python 代码:

import OpenOPC
import time
opc=OpenOPC.client()

opc.connect('Matrikon.OPC.Simulation.1')

tags =['Random.Int4','Random.Real4']

while True:

try:

value = opc.read(tags,group='Group0',update=1)

print (value)

except OpenOPC.TimeoutError:

print ("TimeoutError occured")


time.sleep(5)

但我总是收到此错误消息:

Traceback (most recent call last): File "C:\Program Files (x86)\Python35-32\lib\multiprocessing\queues.py", line 241, in _feed obj = ForkingPickler.dumps(obj) File "C:\Program Files (x86)\Python35-32\lib\multiprocessing\reduction.py", line 50, in dumps cls(buf, protocol).dump(obj) _pickle.PicklingError: Can't pickle : attribute lookup datetime on pywintypes failed.

最佳答案

我找到了解决办法:

import OpenOPC
import time

import pywintypes

pywintypes.datetime = pywintypes.TimeType

opc=OpenOPC.client()

opc.servers()

opc.connect('Matrikon.OPC.Simulation.1')
tags =['Random.Int1','Random.Real4','Random.Int2','Random.Real8']
while True:
try:
value = opc.read(tags,group='Group0',update=1)
print (value)
except OpenOPC.TimeoutError:
print ("TimeoutError occured")

time.sleep(1)

关于python-3.5 - 不能腌制 <class 'pywintypes.datetime' > : attribute lookup datetime on pywintypes failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54683823/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com