I was wondering is it possible to open an "odb" file (results of an Abaqus analysis) with python without using Abaqus? Such as open it with a python interpreter (ex, spyder) and just take out some results from it? without opening abaqus.
Thanks in advance.
Not really. Abaqus output database (called ODB file) is a binary file and I don't think you can read it outside Abaqus unless you know the encryption of it.
However, there are some alternatives available.
Using abaqus python <Abaqus python script name> method to run the your Abaqus python script in Powershell/Command Prompt for windows users and in terminal for Linux users. But, this command requires Abaqus to be installed in your system. And there are some limitations like you can work only with the ODB file (not with .CAE files), you cannot use GUI related commands, etc..
Using open source module called abapy
For 2nd method, you first need to save the ODB data using pickle module using Abaqus python. Then we can post-process it using abapy or any other open source Python module. However, this is recommended when you're doing extensive post-processing.
Related
I am able to open ArcGIS from the batch file but in order for the script to run successfully I need to be able to run it off the python console within ArcGIS. I can copy and paste the code into the python console within ArcGIS but I want to be able to have the code entered into the console automatically just from the batch file. I'm using ArcGIS 10.6. Is there some file path I should be using?
Thanks in advance for any suggestions.
this is rather strange, I don't think I understand the problem here. You want to run Python code from a batch file in the Python console in ArcMap/ArcCatalog?
What is it you want to acomplish?
You can create a standalone Python script, load it in the console and run it.
If you want to schedule something you can create a Python script and run it in PowerShell or cmd.
If you want something to run in ArcMap/ArcCatalog you can create a model or a script and again can run this anywhere, put it in a toolbox, schedule it, whatever.
If you're a windows user first of all it's nice to have the path to python.exe (usually C:\Python27\ArcGIS10.x) in your environment variable so you can call it from anywhere. I think PATH should be updated when you install ArcGIS.
When you run Python code in the console you don't need to import arcpy, however you do need to import it if you will run it from the command line for example.
You can find a nice GDB administration example here:
https://desktop.arcgis.com/en/arcmap/10.6/manage-data/geodatabases/using-python-scripting-to-batch-reconcile-and-post-versions.htm
Careful when dealing with absolute paths, then make sure you're running the script in the same directory.
If you want to define a workspace (some GDB, shapefile or a database connection file) you can reference them like this:
myGdb = r"D:\SomeFolder\MyGDB.gdb"
Hope this helps if it's relevant.
Welcome to the SO community. If I understand you correctly, you do want to run python script from ArcGis's console. You would rather run script from your windows/linux shell/cmd, yes?
SHORT: you should python libs of ARCGis, which you should put into PYTHONPATH enviroment variable. If you configure correctly PYTHONPATH enviroment, then you cound run python gis_script.py which utilize ArcGis.
LONG: sometimes you use libraries in python. If you install libraries in your system, before using this libraries, python interpreter should know about these libraries. This configuration is stored in PYTHONPATH enviroment. ArcGis is large python library.
-- edit --
look here: https://community.esri.com/thread/119922 or google: ArcGis PYTHONPATH
I would like to have my program's associated file types open up directly into my Text Editor created using python's as well as incorporate a drag-and-drop functionality into the core of my program. How would i do this?
Also when trying to open up the associated file type directly using the file.ext link it just opens up a blank screen of my application window. How do i fix this?
I am using Python 2.7.12 for programming and PyInstaller for converting to exe
The files are already associated to my Text Editor via Inno Setup Compiler however I would like them to actually open up properly within the Text Editor itself.
Your program needs to accept parameters, the parameter in this case is going to be the file that will open with the editor that you created.
Drag and drop depends on the GUI framework that you are using. Google the framework that you are using and add "Drag and drop". There is definitely a documentation on how to implement it in the desired framework.
File association usually is done via installers such as the NSIS installer NSIS installer file association
I am new to Python. I want to execute a python script inside which a shared library (*.so file) is included. I try execution on CYGWIN 64 (a Unix-environment on windows). It does not work and found this error: "OSEError: Exec format error". I think that the problem is from the *.so file. How can I execute my python script which uses the shared library (*.so file) within CYGWIN?
I'm using vim as my primary editor with python files; I'd like to be able to easily open python files.
As an example: I'm looking at a particular module A.py, in it I see the line import funkyModule, I want to edit that module so I just type in the command :pyed funkyModule and the pyed vim-command automatically finds the file funkyModule.py (or funkyModule/__init__.py) where ever it occurs on the python path.
This capability is modeled on the capabilities if the ipython shell, where
In [#]: edit funkyModule
does what I've just described.
Simple question:
I have a python program which launches an executable.
The launcher uses optparse module to setup the run and lauch the binary through shell.
Is it possible to bundle the laucher and the binary into a single package?
Platform of interest is Linux.
using pyinstaller for example you could add the executable file as a resource file, it extracts the resources to a temp folder, from there you can access your resource files as you want