import vsp vs import openvsp

194 views
Skip to first unread message

Guan Lao

unread,
Feb 22, 2024, 5:58:29 PM2/22/24
to OpenVSP
Hi-

I have built OpenVSP from source and installed the python package. My question is: why is it that when i call import vsp in cmd, I get something like below:

C:\Users\Lemoning>python
Python 3.9.18 (main, Sep 11 2023, 14:09:26) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import SUAVE
>>> import openvsp
Invalid switch - "Users".
Invalid switch - "Users".
Invalid switch - "Users".
Invalid switch - "Users".
>>> import openvsp as vsp
>>> import vsp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'vsp'

I've added the following to system variable path:
C:\Users\Lemoning\Desktop\OpenVSP\VSP_Build\src\python_api
C:\Users\Lemoning\Desktop\OpenVSP\OpenVSP-3.36.0-win64\OpenVSP-3.36.0-win64\python\openvsp\openvsp

Thanks!

Rob McDonald

unread,
Feb 22, 2024, 7:08:44 PM2/22/24
to ope...@googlegroups.com
The "Invalid switch - "Users"." is harmless and will go away in the next version.

openvsp tries to find and set up the paths to the vspaero executables.  vsp just loads the raw Python wrapper created by Swig.

In the next release, openvsp will have some options to do more cool things.  So in general, the preferred approach is:

import openvsp as vsp

I know nothing about SUAVE and how it uses the OpenVSP API.

Rob


--
You received this message because you are subscribed to the Google Groups "OpenVSP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openvsp+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openvsp/f4be3817-02ea-4c00-957c-040ff2f28dbfn%40googlegroups.com.

Guan Lao

unread,
Feb 22, 2024, 7:25:10 PM2/22/24
to OpenVSP
Got it, thanks for the clarification Rob! I'll probably need to modify the code so that SUAVE recognizes it.

Haoliang Yu

unread,
Mar 3, 2024, 9:43:54 PM3/3/24
to OpenVSP
Hello,

I think I can explain this reading issue in SUAVE. 
The code is written this way because the Python API for OpenVSP was called using "import vsp as vsp" before version 3.26.1, and in subsequent versions, it changed to "import openvsp as vsp." 
I assume the code is written this way to adapt to different versions of VSP. 
In SUAVE version 2.4.0, only "import vsp as vsp" was used, and it wasn't until SUAVE version 2.5.2, released in 2022, that it switched to the calling format shown in the code.

Knight
cf679121204c814a907b2473940bb91.png
Reply all
Reply to author
Forward
0 new messages