Python Forum

Full Version: Python Scripting Environment
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Two or so years ago I wrote a Python Program for ANSYS scripting that had the following code snippet in it:
import ScriptEnv
ScriptEnv.Initialize("Ansoft.ElectronicsDesktop")
.....
infile = open(ScriptArgument,"r")
......
I am now using pyaedt to generate structures and automate EDT 2022.2

This bit of code opened up a smallish directory window that let me se the current directory or navigate to other directories to select a file. In my case I am simply reading in a .csv file. I think the window may have been a reduced size file manager.

It was useful because it remembered the file I selected the next time I accessed so I didn't have to type long filenames.

I cannot find a ScriptEnv module, so the IDE ignores the import and complains that ScriptEnv does not exist.

Is there some other way to implement this capability? I am now using Python 3.8.1. Its possibly that I was using Iron Python previously. This was pretty handy in the other program when I was using it heavily.

Thanks - Jim
(Nov-19-2022, 12:09 PM)jpotter0 Wrote: [ -> ]I cannot find a ScriptEnv module, so the IDE ignores the import and complains that ScriptEnv does not exist.

Is there some other way to implement this capability? I am now using Python 3.8.1
The module is a file ScriptEnv.py search for it.
For it to work so most ScriptEnv.py be in sys.path of Python 3.8.1
Do this to from interactive interpreter to see where Python 3.8.1 look for files.
E.g
>>> import sys
>>> 
>>> sys.path
 'C:\\Python310',
 'C:\\Python310\\lib\\site-packages' 
.....
site-packages is the folder where all folder/files goes into when use pip to install something.