How to compile Jython program so as to generate .class files? - .class-file

I know that Jython before version 2.5 can achieve this by using the command "jythonc". But I am using Jython 2.5.3 now.
What I need is very simple: I want the Jython to compile my Python code and generate the .class files (or Java bytecode) for me, as I would need these .class files to do some analysis works. But unfortunately, the interpreter just directly runs the program without leaving any intermediate representations behind.
P.S.: I'm using a Mac

Related

How to compile .ui file to python using pyside6-uic but with the snake_case and true_property activated

The new version of Qt for Python (PySide6) allows to use a new feature named true_property, this feature you can easily use when you build your UI manually from scratch, but If you are using Qt Designer and you want to convert .ui files to python using pyside6-uic the python code is generated without taking in count that feature. So I want to know if there is a flag option or a command to tell pyside6-uic to use the true_property.

Python Compilation to .exe

I am new to python and need to compile it into .exe version. My question is when a py script is compiled into .exe does it mean it cant decode anymore?
Our goal is make python scripts safe when deploying to client servers as we dont want them to get our source code using the .exe.
No - a compiled piece of code is compiled into another language (byte code) - you can not actually read the source code.
Do have a look at this though...
A savvy user who has this .exe version could extract the .pyc (byte code) and then break that down using a python decompiler like Uncompyle to get it pretty much back to source code. Thus there is a way (and a chance) of the python source code (close to it) getting extracting from your .exe version.

Read Linux or Windows MEX file on Mac OS [duplicate]

I've been given a Matlab program that uses an external C function. I only have the compiled version of this external function, and the extension is .mexglx . From what I have already red, it seems that this extension is the mex-file version compiled with linux. I run matlab under windows XP, and my problem is that my Matlab is not able to read the .mexglx extension. So my question is: is there any mean to change a file with the .mexglx extension to a .mex? Because for the moment I do not have the source code in C, so I can't recompile it correctly. I precise that my version of Matlab is R2007b if it can help.
Thank you for your answer
No there is no way, sorry. You need to get the source code to build it for a different platform.

Creating a Python Project using Atom

I m trying to create a python project in Atom IDE. I downloaded and installed Atom and also some package like project_manager.
I am finding it extremely hard to get going.
My project would have a few python files in the code folder. Some data files in the data folder, etc.
How do I start this in Python. I goggled this as well but still finding it difficult.
P.S. I know how to create python files and run them using IDLE. Want to do my work in a more structured manner by creating a project and then being able to compile and run my files fast and easily.
Regards
Bonson

Linking native hidapi and libusb-1.0 library in eclipse on Ubuntu

I am new to Ubuntu and searched on-line for two days, tried a lot of solutions but do not have any luck yet. If anyone can help with this, I will appreciate.
I wrote a program in Java with eclipse on Windows. My program makes use of Java hidapi library, which is a Java wrapper of the C version hidapi library (.dll). In eclipse, by adding the Java hidapi to the build path and setting the C hidapi as a native library, everything works just fine.
Now I want to do the same on Ubuntu. The same Java hidapi is used, which now will make use of the C version hidapi library for Linux (a .so file). When making the C version hidapi library for Linux, it turns out that I need another library called libusb-1.0 (which hidapi needs to deals with the low level communication). So I install libusb-1.0 (now I have a libusb-1.0.so file under /usr/lib/i386-linux-gnu), make the C version hidapi library for Linux. I have a small C program and I test it under bash, it works so I believe until this point everything, both libsub-1.0.so and C version hidapi library for Linux libhidapi-jni.so are installed/generated correctly, and when running the small C program the system is able to find the shared libusb-1.0.so library without explicitly mentioning where libsub-1.0 is (which makes sense because libusb-1.0 is installed in a place where the system loader will always search).
So I go to eclipse. I import the eclipse work space, add the Java hidapi to the build path (as I did in Windows), move the C version hidapi library for Linux (the .so file) into a folder called 'lib' (where the .dll version of native library also resides). And I set the native library to 'lib', by "build path" -> "configure build path" -> "libraries" tab -> "native library location". So till this point, the two native libraries are: libusb-1.0 under /usr/lib/i386-linux-gnu, and hidapi.so under 'wherever eclipse workspace is'/lib. Finally in the source code I add two lines:
System.loadLibrary("usb-1.0"); // Call this line A.
System.loadLibrary("hidapi-jni"); // Call this line B.
I run the program as a Java application. It reports "java.lang.UnsatisfiedLinkError: no usb-1.0 in java.library.path" at line A. So I guess the Java runtime is not able to find where libsub-1.0 is.
Just for clarification, I already did the following trials, none of them worked.
Remain the two libraries where they are, add vm argument (Run -> Run Configuration -> Arguments -> VM arguments): -Djava.library.path="${workspace_loc:project_name}/lib;
/usr/lib/i386-linux-gnu". It gives: "java.lang.UnsatisfiedLinkError: no usb-1.0 in java.library.path" at line A.
Undo 1. Move libsub-1.0.so to 'wherever eclipse workspace is'/lib, so now the two .so files are together. Set .jar's native library location to this folder. It gives "java.lang.UnsatisfiedLinkError: blablabla: undefined symbol: libusb_control_transfer" at line B. So I think it founds the libusb library, however the symbol (which should be in libusb) is still unresolved. This is really weird.
Can anyone help me? Thanks in advance.

Resources