Skip to content

Problem with 'import pyesapi' #26

Open

Description

@maksymfritsak

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

Activity

  1. mvarsta commented on Oct 5, 2023

    @mvarsta

    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.

  2. fizxmike commented on Jul 29, 2024

    @fizxmike
    Member

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

  3. LuisOlivaresJ commented on Jul 31, 2024

    @LuisOlivaresJ

    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

  4. LuisOlivaresJ commented on Jul 31, 2024

    @LuisOlivaresJ

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions