I recently moved my code to a new computer at work. A basic example code is as follows (but you wouldn't be able to run it as you can't connect to my server - sorry that I couldn't make it any more reproducible).
With the new computer, I get the following error:
System.ArgumentException: since Python.NET 3.0 int can not be converted to Enum implicitly. Use Enum(int_value) in method OSIsoft.AF.Asset.AFValue RecordedValue(OSIsoft.AF.Time.AFTime, OSIsoft.AF.Data.AFRetrievalMode) ---> Python.Runtime.PythonException: since Python.NET 3.0 int can not be converted to Enum implicitly. Use Enum(int_value)*".
My old computer uses Spyder 4 and Python 3.7 and Python.NET 2.5.2. The new computer uses Spyder 5 and Python 3.9 and Python.NET 3.0. Because of IT restrictions, I am unable to install the same version of Spyder and Python on my computer. However, I do not think it is causing this error.
Would anyone have any idea what would cause an Enum-related problem? Thanks!
import PIconnect as PI
def pidownload(tag):
with PI.PIServer() as server:
point = server.search(tag)[0]
data = point.recorded_value('-1m')
data=data.to_frame()
return data
tag='xxxx.pv' #confidential data tag replaced with xxxx
print(pidownload(tag))