what is best and easy way for convert maya py (python) to pyd ?
I had explored in this field, but unfortunately none of them was effective and after convert to pyd I can't import my code into Maya.
pyd files contain native binary python extensions, usially developped using Python C API and some native language.
cython might be the simplest tool that might help you creating pyd by compiling a subset of Python source code.
What are you trying to achieve ?
Related
I want to make a small application with graphical interface with Python but I want to do the calculations in another language such as C++ or Golang, is it possible ?
Build a .dll or .so file from your C++ source, then use Python's ctypes to import the functions from it. Alternatively, use the Python C API to create an extension module. The difference is that in the first approach, the interop code will be in Python, and in the second, it will be in your native code.
This question already has answers here:
Make executable file from multiple pyx files using cython
(2 answers)
Closed 3 years ago.
I know this might seem like a question that has been asked over several times, though it is a bit different.
I am very new to cython, like as new as just started knowing about it since yesterday, and came to know that it can be used to convert pure python codes to binary executable, with the help of GCC.
I have a huge Python project with multiple dependencies, including Stanford NER, Spacy NER, some custom pure python dependencies, and some core python libraries. I want to convert this whole project with multiple code files to an executable but before that I want to convert it into a c type file that can be made into an executable through GCC.
Now, I know with cython embed option can convert a pure python file into a .C type file, but does that also grab the used dependencies, or does it just convert the specific .py file to .C file. Also, the custom dependencies use some other custom dependencies inside them, so when I convert the main driver code, will it also grab all the underlying dependencies?
I have already researched about Pyinstaller and Py2Exe, but that will not exactly serve my purpose, as I want a .C code that can be compiled later on.
disclaimer: Not sure I'm the best person to answer this.
I don't think cython is very suitable for what you want to do (that is automatic conversion of large python project to C). Cython sill require quite significant effort to use (you need to specify types, you often need to re-arrange the code. Sometimes it is rather difficult to specify proper types for anything more complex (e.g. numpy arrays)).
Honestly I don't have much experience in using 3rd party libaries from within cython (.pyx), since I use cython for excatlly the opposite purpose (to write low-level performance critical computational core in cython (which has no dependencies) which is than imported in high-level python scripts). I think that is the intended use case.
=>
I would follow that strategy - write only the minimum of code in cython, and than outer high-level python as a glue-language to bind the external libraries.
I want to make a kind of Python wrapper for wkhtmltopdf, build from C/C++ sources.
For this i've expected to use ctypes but wkhtmltopdf uses various structures who contain specific types like QPrinter and many others.
Does anybody knows how to use non-standard ctypes fields with Python and the ctypes module ?
I'm also searching informations about using Python-ctypes with c++ source ( .dll library) if someone knows more than me about this, i'll enjoy to learn about those things :)
Thanks a lot !
I'd recommend that you use a wrapper like py-wkhtmltox instead of trying to use the C API for libwkhtmltox via ctypes.
I'm writing a Python-based [web] application that needs to be able to read and write EXIF data.
libexif seems to have all the right ingredients, but I can't work out how (or if) I could access it access it by using Python's ctypes library? I'm new to C, suppose I need see a .so for this to work?
You need to be running on an os that you can obtain the required library, to download the .h files, (usually the -dev package gives you these).
Then you need to work your way through the ctypes tutorial found here which explains all the steps you need to take.
Is there a python module that has the functionality for computing rdiff signatures and delta differencing?
I need to perform these operations on a cross-platform application so I'll need something that will bundle into py2exe, py2app etc.
I've done a bunch of searching but I can't seem to get anything working. Pysync, rdiff-backup, librsync all come up but I've not been able to get anything working inside of python.
rdiff-backup is written in Python. It appears to be using librsync under the covers and has a Python wrapper for it (look for _librsyncmodule.c in the source tree).
The following page may help to figure out how to build librsync on OS X and Windows: link.