How to share AutoKey and TextExpander snippet files : json vs. xml - python

I'm using AutoKey on Ubuntu (12.04) and it works fine. Now I want to use a shared DropBox file, containing all snippets, however this is a TextExpander file because my colleges use MACs and have another app like AutoKey, called TextExpander.
Their .textexpander file seem to be XML, while my AutoKey uses JSON files.
Can I use a shared .textexpander XML-file with my AutoKey program?
Is it possible to redirect / convert the .textexpander snippets file (on DropBox) to an autokey.json file, eg. with a Python script and if then how?
Note: I'm not a linux novice, so I can create / adjust some python scripts and access the file system.

Related

Open Abaqus odb file independently in python

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.

how can I run custom extension files in python script?

I have a file with extension (.logs) which has the data without xml format. I also have a tool say abc.exe (added to PATH) which takes the .logs file as input and generates a new file with properly formatted XML. So, I'm trying to run the same tool using python, MY.py is reading the input file rather running it using abc.exe. How can I make the file run using abc.exe using pythons scripting?
If you want to lunch your program (let's say, abc.exe), just use this code:
import subprocess
subprocess.Popen(["abc.exe", "arg1","arg2"])

python .pyc file with win32com

I have a project that uses COM and 'Python' scripting. Earlier we were using 'ComTypes' now we use Win32Com. To keep backward compatibility I need to change name of some of the interfaces. So here is what I do
1) Use the 'makepy' utility to create a python file from my .tlb file, this creates a .py file at ..\Lib\site-packages\win32com\gen_py folder
2) I change the name of the interface that I am interested in changing in the created python file.
3) When I load my application a corresponding .pyc file gets created and everything works fine.
Now I don't want to repeat this exercise on every machine where my software is deployed. So through the installer I copy the .py and .pyc files to ..\Lib\site-packages\win32com\gen_py
But when my application is launched it does not recognize the changed interface. Behaves as if there is no .py or .pyc file. All other interfaces work, but the changed name one does not work. It dynamically seem to create compiled python behind the scene, ignoring the .pyc file.
If I delete the .dat file and .pyc file at those locations, it does create the .pyc file again when the application is launched. However its not utilized, because my changed interface does not work.
If I use the steps 1,2 and 3 everything works again !! I am puzzled.
Please help.
OK. I found out what is the problem. When you create a python file using makepy tool it updates the dicts.dat file in gen_py directory. So you need to copy over that file as well to other machines.

Converting XML Data web file to XLS file in python on linux

I'm beginner in python programming and i'm currently struglling to find a solution with my python script. Here is my issue,
I wrote a small script in python using python-excel modules ( xlwt,xlrd and xlutils). This script is using an xls file that i converted from a xml data web file manualy by opening it and save it as a xls when i have done the local test.
But as i'm installing my script on a linux server side, i need to make this conversion automatically by using a python script but a i can't figure out how to do it ?
I looked over xlutils but i didn't find a way to make it.
By the way the purpose of this script is to compare 2 xls files and create a new update xls file.
Is it possible to do it with python ? or maybe directly on linux command tool?
Thanks
N.B: sorry for my poor english.

How to create a .py file for Google App Engine?

I am just at the very start of what I think is gonna be a long journey exploring the world of applications in Google App Engine using Python.
I have just downloaded Python 2.6.4 from the Python official website and installed it on my computer (I am using Windows XP). I also downloaded the App Engine Python software development kit (SDK) (from this page) and installed it, too. Both of these steps were suggested on the second page of Google App Engine's Getting-Started Guide.
However, when I moved on to the third page, which is titled as "Hello, World!", I ran into a sort of complication. It is written there:
"Create a directory named helloworld.
All files for this application reside
in this directory. Inside the
helloworld directory, create a file
named helloworld.py, and give it the
following contents..."
I am kind of puzzled here: How do I create a .py file? Is it like I need to create a notepad file (.txt) and name it helloworld.py (when I did so, it didn't change into any different file of any different, but rather stayed an ordinary .txt file) or should I somehow create that file using Google App Engine Launcher that I have installed?
When you downloaded and installed Python, you also installed IDLE. You can use this to easily write, run, debug and save .py files with syntax highlighting. To get started, just open IDLE, and select File -> New Window.
A .py file is a text file containing Python syntax. Use your favourite programming editor, or even NotePad.
Regarding your second problem, there's an option in Windows Explorer about hiding file extensions. Make sure it isn't checked -- you might well actually have renamed your file helloworld.py.txt but only seen helloworld.py
You will need a better editor than Notepad. With Notepad, use Save As..., and type "helloworld.py" in the dialog, including quotes so that the file extension is .py instead of .txt
I am kind of puzzled here: How do I create a .py file? Is it like I need to create a notepad file (.txt) and name it helloworld.py?
I'm not on windows, but thats how it works on other operating systems: Create a file with an editor, then save as ...
ps. and .py is the extension (like .docx, .bat, ...), but it's just a convention (although a highly recommended one) ..
pps. heard the http://www.e-texteditor.com/ has more capabilities than notepad ..
You have to be aware that the ending signifies recognition of files, not content. Name a file .py simply hints to the user (and the GUI) that it most likely is a python file.
That being said, python files are merely text files. You can simply create a text file with Notepad (or your editor of choice) and rename the ending to .py and work from there. Most modern editors will also highlight the syntax based on file endings.

Categories