It's the first time I'm trying to run scripts on the Abaqus server from my university. The IT team provided me the credentials to access the server, but they don't know how to run scripts from there. I'm using Putty to connect to the server, and Filezilla to transfer files.
I tried to run Python scripts from the work directory on the server, but this error came out:
Traceback (most recent call last):
File "SMAPylModules/SMAPylDriverPy.m/src/driverEnv.py", line 324, in envRunFile
File "/home/gd00357/abaqus_v6.env", line 208, in <module>
raise 'Cannot find the graphics configuration environment file (graphicsConfig.env)'
I couldn't find any documentation on how to run Python scripts, I hope it's possible in some way.
How could I solve that error?
EDIT:
Ok, apparently remote servers don't support any scripts that make use of the GUI.
Now my question is: how do I import a model as input file (.inp) using a Python script? Is there a way that avoids that a Python script uses the GUI?
Abaqus has some built-in tools for scripting parametric studies.
Please read about parametric studies in the Abaqus manual here.
Related
I am currently developing a macOS AppKit application that depends on running a shell script which is included inside the app bundle. Only when running in Catalina, the following error is produced upon running the script through a Task:
Traceback (most recent call last): File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
I was able to stop the issue from occurring by completely disabling App Sandbox in the Xcode project. The Task's currentDirectoryURL is set to a location which the app explicitly allowed to access according to the Sandbox exceptions.
How can I run the bundled script without disabling App Sandbox?
I'm fairly new at this myself, so I could be wrong, but I'm working on an app that is using a task for an external process, and this is what solved my permission issues.
There are other permissions you can grant in the entitlements file. https://developer.apple.com/documentation/security/app_sandbox_entitlements
I am currently using both the PyMonzo library and the Adafruit_Neopixel library in my python on Raspberry Pi. In short, I can run the PyMonzo codes if I run as a normal user, but I need to run the Neopixel codes as root. However, PyMonzo codes give me errors when I run as root, while the Neopixel codes give me errors when I do not run as root.
I use the PyMonzo library to access the Monzo API, get my account information, and output that onto a screen. The library can be found here: https://github.com/pawelad/pymonzo
I have managed to set up the API access following all the instructions in the readme, saving the client ID, client secret and auth code in the auth.py file. The codes work when I run them normally, i.e. python3 filename.py, and I can obtain my transaction data, balance, etc. with no problem.
However, I am also using the Adafruit Neopixel library to control some LED lights at the same time. The library can be found here: https://github.com/adafruit/Adafruit_NeoPixel Using this library apparently has two constraints: it has to be run in Python 3, and it has to be run as root. The documentation explains that "For NeoPixels to work on Raspberry Pi, you must run the code as root! Root access is required to access the RPi peripherals." Further documentation can be found here: https://cdn-learn.adafruit.com/downloads/pdf/neopixels-on-raspberry-pi.pdf
When I run sudo python3 filename.py, the error message:
Traceback (most recent call last):
File "filename.py", line 34, in
monzo = MonzoAPI( )
File "/usr/local/lib/python3.5/dist-packages/pymonzo/monzo_api.py", line 106, in init
"To authenticate and use Monzo public API you need to pass "
ValueError: To authenticate and use Monzo public API you need to pass (or set as environment variables either the access token or all of client ID, client secret and authentication code. For more info see https://github.com/pawelad/pymonzo#authentication
If I run the code normally without using sudo, the error I get is:
Can't open /dev/mem: Operation not permitted
Traceback (most recent call last):
File "filename.py", line 66, in
neopix.show( )
.....
RuntimeError: ws2811_init failed with code -5 (mmap( ) failed)
swig/python detected a memory leak of type 'ws2811_t *', no destructor found
Does anyone know if there is a way to deconflict between these two operations, perhaps a way that pyMonzo can be run as root?
I have tried running sudo chmod 666 /dev/mem, and running it without sudo.
Thank you very much.
I don't know how you can run pyMonzo as root, but I know how you can run your python3 Neopixel code as not-root.
I faced a similar issue and found no joy in Adafruit's documentation. But if you go to the documentation of the rpi_ws281x library itself there's more info:
The GPIOs that can be used are limited by the hardware of the Pi and
will vary based on the method used to drive them (PWM, PCM or SPI).
I found it advantageous to drive them with SPI as I was using audio on the board, and you need to disable that to use PWM or PCM.
Discovered then that if you run your Neopixels from pin GPIO 10 and use SPI instead of PWM or PCM, that brings with it this nifty little benefit:
SPI requires you to be in the gpio group if you wish to control your
LEDs without root.
So add your user to the gpio group and hey presto, you're good to run without root.
I have a python program that has been running well for several years on a laptop in my office. The laptop is a windows device and python was installed using a windows installer. I am using python 2.7.8 on my laptop. The program basically checks an email address for specific emails and if it finds them it processes the data in them, re-packages the data into png's and ftp's it to a specific folder on my Godaddy shared hosting account and my website will then display the images. Been working fine for years. However that laptop has now died and it's now time I put this python program in the cloud. While Godaddy does has python its default version is 2.6.6 but you can access their 2.7.2 version with #!/usr/local/bin/python2.7 but since it is only 2.7.2 I decided to install python 2.7.8 on my shared hosting account since that is the version I have been successful with. So now that I have manually installed python I am running my program via SSH to see where it chokes and add the necessary packages. I am at a point where I am a bit stumped. I am getting a connection refused error;
Traceback (most recent call last):
File "CTWRT.py", line 627, in <module>
myEmailConnection = poplib.POP3_SSL(mailServer)
File "/home/tcimaglia/python27/lib/python2.7/poplib.py", line 350, in __init__
raise socket.error, msg
error: [Errno 111] Connection refused
mailServer = "pop.secureserver.net"
Does this have anything to do with running this program on the Godaddy shared host and trying to access an email that is linked to this account, something#my-domain.com? This command works just fine when running on my laptop. Should mailServer be something else?
I am extremely new to Python but discovered that I need it in order to programme my Digi ConnectPort TS1W MEI gateway. What I want to do is read from the serial port periodically then send this data wirelessly to the nearest access point. What I have started with is trying to open, read, write and close the serial port, and I have got the following code so far:
https://www.dropbox.com/sh/1yq4x09xi5w4dsm/CuuZCIjwRT
But the code was not designed for my model of gateway, and the error message I received is:
Traceback (most recent call last):
File “WEB/python/serial_loopback.py”, line 28, in ? import serial.
ImportError: No module named serial.
When running the following command through Telnet:
python serial_loopback.py
I'm not sure if any of you Python programmers out there would know how to go about fixing this sort of thing?
I think #msvalkon means you need to:
pip install pyserial
See installation docs:
pyserial#installation
So I have an SSH session to a windows XP box via WinSSHD (from Ubuntu). I coded up a small Python program to take a screenshot with pywin32. Everything works fine when I run the script on the XP box directly in a normal 'desktop' session but if I SSH in and run the script the script fails:
Traceback (most recent call last):
File "ss.py", line 38, in <module>
win32_ss()
File "ss.py", line 19, in win32_ss
cDC.BitBlt((0, 0),(w, h) , dcObj, (0, 0), win32con.SRCCOPY)
win32ui.error: BitBlt failed
I am assuming this is because the SSH session is a different session than the XP session and has no access to the 'desktop' display device. I found reference on how to do this (I think this is what I want to do) in linux:
DISPLAY=:0.0 import -window root /tmp/shot.png
I suppose what I'm looking for is how to do this in windows. Again, I'm using Python and can install any module needed. I currently am using pywin32 as this is much faster than PIL.
I think SSH is the problem. I am not sure if SSH is the best way to do this. The best way would be to do the screenshot work at Windows' end. I have done something similar recently. I wanted to take a screenshot of a webpage opened in Internet Explorer and I am using Selenium Webdriver for this purpose with Python bindings for it.
What I did was that I decided to do it with the help of TCP sockets. I just wrote a very simple Python script that opens a TCP socket on the Windows machine and listens for connections. As soon as it receives the connection, it does the work of taking the screenshot. So in your case, it can take the screenshot there and save it locally and then the script can SSH to the system where you want this file to be.
Hope this helps.