Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not connect to PI server #717

Open
paitoncamp opened this issue Sep 4, 2023 · 4 comments
Open

Can not connect to PI server #717

paitoncamp opened this issue Sep 4, 2023 · 4 comments

Comments

@paitoncamp
Copy link

paitoncamp commented Sep 4, 2023

Hi
its a great project that I found to implement PISDK as python library,
I try to use this library but I got this error message,
What should I do

D:\piconnect-test>python test1.py OSIsoft(r) AF SDK Version: 2.10.8.440 Traceback (most recent call last): File "D:\piconnect-test\test1.py", line 1, in <module> import PIconnect as PI File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\__init__.py", line 7, in <module> from PIconnect.PI import PIServer File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\PI.py", line 7, in <module> import PIconnect.PIPoint as PIPoint_ File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\PIPoint.py", line 3, in <module> import PIconnect._typing.AF as _AFtyping File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\_typing\__init__.py", line 1, in <module> from . import AF File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\_typing\AF.py", line 4, in <module> from . import PI, Asset, Data, EventFrame, Time, UnitsOfMeasure File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\_typing\PI.py", line 5, in <module> from . import Data, Generic, Time, _values, dotnet as System File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\_typing\Data.py", line 3, in <module> from . import Time, Generic File "D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\_typing\Time.py", line 2, in <module> from . import dotnet as System ImportError: cannot import name 'dotnet' from partially initialized module 'PIconnect._typing' (most likely due to a circular import) (D:\Programs\Python\lib\site-packages\piconnect-0.10.6-py3.9.egg\PIconnect\_typing\__init__.py)

@diegouriarte
Copy link

I've found the same problem in a new installation. Context:

  • Windows 10 laptop
  • Using anaconda
  • Install using pip install pip install PIconnect
  • When I run
    import PIconnect as PI
    I get the following
OSIsoft(r) AF SDK Version: 2.10.8.440

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_38820\1377011707.py in <module>
----> 1 import PIconnect as PI

~\Anaconda3\lib\site-packages\PIconnect\__init__.py in <module>
      4 from PIconnect.AFSDK import AF, AF_SDK_VERSION
      5 from PIconnect.config import PIConfig
----> 6 from PIconnect.PI import PIServer
      7 from PIconnect.PIAF import PIAFDatabase
      8 

~\Anaconda3\lib\site-packages\PIconnect\PI.py in <module>
      4 from typing import Any, Dict, List, Optional, Union, cast
      5 
----> 6 import PIconnect.PIPoint as PIPoint_
      7 from PIconnect import AF, PIConsts
      8 from PIconnect._utils import InitialisationWarning

~\Anaconda3\lib\site-packages\PIconnect\PIPoint.py in <module>
      3 from typing import Any, Dict, Optional
      4 
----> 5 import PIconnect._typing.AF as _AFtyping
      6 from PIconnect import AF, PIData, _time
      7 

~\Anaconda3\lib\site-packages\PIconnect\_typing\__init__.py in <module>
      1 """Type stubs for the AF SDK and dotnet libraries."""
      2 
----> 3 from . import dotnet as System  # noqa: I001
      4 from . import AF
      5 

ImportError: cannot import name 'dotnet' from partially initialized module 'PIconnect._typing' (most likely due to a circular import) (C:\Users\R112619\Anaconda3\lib\site-packages\PIconnect\_typing\__init__.py)

So it seems at least recognizes the SDK version.

I would appreciate any advice

@Hugovdberg
Copy link
Owner

Apparently something has changed in the sdk version 2.10, that causes the import to partially fail. I will have to dig into the documentation to find out what has changed without backward compatibility.

@Hugovdberg
Copy link
Owner

Interestingly, I just noticed both of you experience this issue on SDK version 2.10.8.440, but on my system I have 2.10.9.593 and no issues. Also, looking closer at the stack trace I fails after the SDK is loaded, so no issues with the SDK or pythonnet.

I see in the error @paitoncamp posted it occurs in PIconnect 0.10.6 on Python 3.9, @diegouriarte what version of python and PIconnect are you running? I suspect that the last python 3.9 compatible version was actually faulty but that would only be an explanation if the both of you actually use that python version.

@diegouriarte
Copy link

Hi, yes my Python version is 3.9.13 and PIConnect version 0.11.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants