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

Problem with 'import pyesapi' #26

Open
maksymfritsak opened this issue Oct 5, 2023 · 4 comments
Open

Problem with 'import pyesapi' #26

maksymfritsak opened this issue Oct 5, 2023 · 4 comments

Comments

@maksymfritsak
Copy link

Hello,
Installation was without any errors. However, when I run "import pyesapi" the following exception pops up:

Exception Traceback (most recent call last)
Cell In[2], line 1
----> 1 import pyesapi
2 #import atexit
3 #app = pyesapi.CustomScriptExecutable.CreateApplication('python_demo')
4 #atexit.register(app.Dispose);

File ~\AppData\Roaming\Python\Python311\site-packages\pyesapi_init_.py:44
41 paths = [os.path.join(drive, os.sep, base, ver, rp) for rp in rpaths]
43 if len(paths) < 2:
---> 44 raise Exception("Did not find required library paths! Searched for:\n %s" % (",\n".join(searched_paths)))
45 if len(paths) > 2:
46 print("WARNING: Found multiple possible VMS dll locations:\n %s" % (",\n".join(paths)))

Exception: Did not find required library paths! Searched for:
C:\Program Files (x86)\Varian\RTM%version\esapi\API,
C:\Program Files (x86)\Varian\RTM%version\ExternalBeam,
D:\Program Files (x86)\Varian\RTM%version\esapi\API,
D:\Program Files (x86)\Varian\RTM%version\ExternalBeam

How one can solve this?
Best wishes,
Maksym

@mvarsta
Copy link

mvarsta commented Oct 5, 2023

PyESAPI is pythonnet wrapper over ESAPI/Eclipse and requires Eclipse installation to work. The exception tells that PyESAPI cannot find the requisite libraries in expected locations so try on machine with Eclipse installation at hand. ESAPI alone will not cut it because ESAPI, which is UI-less Eclipse client with some restrictions, relies on Eclipse proper.

@fizxmike fizxmike reopened this Jul 29, 2024
@fizxmike
Copy link
Member

Hi @maksymfritsak,
Can you confirm if you are trying to run PyESAPI from an Eclipse TBOX or VIC environment?

@LuisOlivaresJ
Copy link

LuisOlivaresJ commented Jul 31, 2024

Hi, I also have an import problem:

(pyesapi) C:\Users\lolivares>python
Python 3.10.12 | packaged by Anaconda, Inc. | (main, Jul  5 2023, 19:01:18) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyesapi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\lolivares\AppData\Local\anaconda3\envs\pyesapi\lib\site-packages\pyesapi\__init__.py", line 83, in <module>
    from VMS.TPS.Common.Model.Types import *
ModuleNotFoundError: No module named 'VMS.TPS.Common.Model.Types'

My path to VMS...dll files is:

C:\Program Files (x86)\Varian\RTM\16.1\esapi\API

Additional info:
I am working in a TBOX, with Eclipse 16.1
I am usign a conda virtual environment (named pyesapi)
I have pyesapy 0.2.5, installed by pip install pyesapi

@LuisOlivaresJ
Copy link

LuisOlivaresJ commented Jul 31, 2024

Adding a reference seems to solve the problem:

clr.AddReference('VMS.TPS.Common.Model.Types')

I added it, next to line 74, and now I do not have the import error

clr.AddReference('VMS.TPS.Common.Model.API')

If it is possible, I would like to create a pull request with the addition.

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

4 participants