Hi all
I was trying to run a python script to define a P3D project - the P3D version is PLAXIS 3D CONNECT Edition V21 Update 1 - but I cannot successfully run it as indicated by the tutorial video https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/45880/remote-scripting-api-drivemining
One different thing is that I'm using Spyder instead of Idle editor, I'm not sure if it's the reason, and I've got warning like shown in the figure:
The code I used is: (exactly the same as the tutorial except the plaxis_path, and I do see the plxscripting folder in this path)
plaxis_path = r'C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Internal Distribution V1 Update 1\python_internal\Lib\site-packages'import impimport mathfound_module = imp.find_module('plxscripting', [plaxis_path])plxscripting = imp.load_module('plxscripting', *found_module)from plxscripting.easy import *
And the error message shows:
File "C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Internal Distribution V1 Update 1\python_internal\Lib\site-packages\plxscripting\connection.py", line 32, in <module> import encryption
ModuleNotFoundError: No module named 'encryption'
I checked the files within the plxscripting folder, and there is no module called 'encryption' (unlike a similar question in the forum that he can see the 'encryption' but cannot find it). Should I download this module from somewhere? Or is it the problem of the plaxis_path?
Hope my description is clear, thanks
Dear Catherine,
First of all the boilerplate is outdated. Please check the code included in this article: https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/46005/using-plaxis-remote-scripting-with-the-python-wrapper
The reason is that the inp module is nowadays deprecated so we needed to update our boilerplate to:
from plxscripting.easy import * s_i, g_i = new_server('localhost', 10000, password='yourpassword')
Second of all, since you are not using the SciTE that PLAXIS offers (that is fine!) you need to make sure that spyder knows exactly where the PLAXIS Python distribution is and point to that one.
There are quite a few articles online that explain how to do that such as:
Keep in mind that for PLAXIS 3D CONNECT Edition V21 Update 1 you should use the python.exe that is in the following folder:C:\ProgramData\Bentley\Geotechnical\PLAXIS Python Distribution V1 Update 1\python
Following that you should be able to run any Python script via spyder.
If you still need help, please submit a service request. Then, one of our support engineers can help you in detail: https://apps.bentley.com/srmanager/ProductSupport
Answer Verified By: Catherine Jiang
When I changed the Python interpreter to the directory you listed, the following error occurred. I thought it should be a default directory and should be directly usable, but does this mean I need to download the module separately? If so, where shall I save the module? Is there any extra step after downloading it?
It seems the spyder version is not fully compatible to run Python code with our distribution.
But you can definitely try and install the modules it mentions by following this article: https://communities.bentley.com/products/geotech-analysis/w/plaxis-soilvision-wiki/51822/how-to-install-additional-python-modules-in-plaxis
It looks like it'll be working without changing the Python Interpreter
Hi Catherine,
I don't know if you got this solved, but I was having the same issue but have managed to fix it so Spyder now successfully links to PLAXIS. The link I found that helped me is on my chat with Stefanos here: Python interpreter - PLAXIS | SOILVISION Forum - PLAXIS | SOI LVISION - Bentley Communities