PyESAPI
PyESAPI copied to clipboard
Problem with 'import pyesapi'
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
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.
Hi @maksymfritsak, Can you confirm if you are trying to run PyESAPI from an Eclipse TBOX or VIC environment?
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
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 https://github.com/VarianAPIs/PyESAPI/blob/2d5cd95a94361ec36b7c9e2f738c360b956bc1cf/pyesapi/init.py#L74
If it is possible, I would like to create a pull request with the addition.