How to import a custom Python module in PSSE?

asked 2019-05-02 19:28:18 -0500

drsgao gravatar image

Hi all, I have encountered a problem with importing some custom Python modules inside PSSE recently. The funny thing is that it seems to work when the user has admin right and it would not work if the user is not admin.

Basically, I have written a few custom Python modules which would be imported by the main Python script. The main Python script is run inside PSSE to manipulate the SLD. All scripts and modules are placed in the same directory.

When I ran the main script in PSSE on my computer (I am local admin), everything ran fine and the results were as expected. The problem came when I shared all the scripts and modules with another user, who was not an admin. When the said user tried to run the main script inside PSSE, PSSE raised import errors, saying that it could not find the custom modules. Though I could clever see that the modules were in the same folder as the main script.

Since all scripts and modules are in the same folder, I do not think path is the cause of the error. Is it about the admin right?

I think a possible workaround is to bundle everything needed into one single script, then I do not need to import the custom modules. But I would hate to do something like that since this would be an anti-pattern and it would be a disaster for maintenance and it would also cause fragmentation.

Anyway, is it really about the lack of admin right that caused the import error?

edit retag flag offensive close merge delete

Comments

How are you and your colleagues running the script inside PSSE? With "Run program automation file" or with a programmed custom button?

perolofl gravatar imageperolofl ( 2019-05-06 04:25:19 -0500 )edit

Hi, we just click the default button 'Run Automation File'. The file inclues a few import lines, 'import psspy, sliderPy import diffSLD'. The Python interpreter points the error to the line of 'import diffSLD'. This lib is placed in the same folder as the main script.

drsgao gravatar imagedrsgao ( 2019-05-08 04:29:09 -0500 )edit