Python Forum
Python Scripting Environment
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Scripting Environment
#1
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
Yoriz write Nov-19-2022, 12:30 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#2
(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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Installing python packages in a virtual environment Led_Zeppelin 1 768 Aug-15-2023, 08:18 PM
Last Post: deanhystad
  Blender scripting the_jl_zone 0 468 Jul-10-2023, 08:48 PM
Last Post: the_jl_zone
  Understanding venv; How do I ensure my python script uses the environment every time? Calab 1 2,283 May-10-2023, 02:13 PM
Last Post: Calab
  Python development environment standenman 3 1,642 May-04-2023, 07:24 PM
Last Post: snippsat
  How do I link the virtual environment of that project to the 3.9.2 version of python? Bryant11 1 1,375 Feb-26-2022, 11:15 AM
Last Post: Larz60+
  VS Code debugger using wrong Python environment topfox 0 2,515 Jun-09-2021, 10:01 AM
Last Post: topfox
  Virtual environment and upgrading python 3.5 to 3.9 NeilUK 4 12,149 Jan-24-2021, 01:02 PM
Last Post: snippsat
  Installing keras in Python 2.7 environment ErnestTBass 3 5,455 Nov-01-2020, 08:36 PM
Last Post: jefsummers
  Python in Linux environment on RPI kendias 22 11,104 Sep-05-2020, 03:04 AM
Last Post: K_Research
  Scripting: Multiple Votes With a Single Click or Button Ovidiu 0 1,391 Jul-07-2020, 10:51 AM
Last Post: Ovidiu

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020