Dawid Anioł Blog

Tag: python

Compilation of the code in Python

Sometimes  it is necessary to share application with someone else, and one would like to hide fragments of the code. It is very likely that it will occur on desktop applications, in which user would like to run the program offline. In Python there are some problems with it, because it is interpretable language. As it is at present  in 2018 we don’t have possibility to secure the Python source code from viewing it.

Without going in to much detail, with help of the Python you can „compile” code to the form unreadable for human. „Decompiliation” of such code is not trivial even for advanced users. In most cases, this form is fairly enough.

Compilation of all .py files in current directory :

python -m compileall .

Bibligraphy:

  • http://effbot.org/zone/python-compile.htm
  • https://docs.python.org/3/library/compileall.html#module-compileall

O, o … ImportError: DLL load failed: The specified procedure could not be found.

Problem with DLL files under the Windows system when it comes to using libraries such as numpy or OpenCV it might give you a few problems. Often the problem is lack of standard VisualStudio libraries in which libraries were compiled. Then in this case all you need is Visual C++ redistributable 2015 in the right version or Universal C runtime. If this is not enough and the problem appear which library is missing and in what version it should be.

With help comes two simple tools. Dependencywalker – which check dependencies in Windows. It is vintage tool and it can’t solve properly all dependencies. Second tool is procmon, it tell us where Python is looking for libraries and why it cannot find it.

Copyright © 2024 Dawid Anioł Blog

Theme by Anders NorenUp ↑