3.5. Error Messages

Here list all the errors when running pyarmor or obfuscated scripts.

If something is wrong, search error message here to find the reason.

If no exact error message found, most likely it’s not caused by Pyarmor, search it in google or any other search engine to find the solution.

3.5.1. Building Errors

Obfuscating Errors

Table-1. Build Errors
Error Reasons
out of license

Using not available features, for example, big script

Purchasing license to unlock the limitations, refer to License Types

not machine id

This machine is not registered, or the hardware information is changed.

Try to register Pyarmor again to fix it.

query machine id failed

Could not get hardware information in this machine

Pyarmor need query hard disk serial number, mac address etc.

If it could not get hardware information, it complains of this.

relative import “%s” overflow

Obfuscating .py script which uses relative import

Solution: obfuscating the whole package (path), instead of one module (file) separately

Registering Errors

Table-1.1 Register Errors
Error Reasons
HTTP Error 400: Bad Request Please upgrade Pyarmor to 8.2+ to get the exact error message
HTTP Error 401: Unauthorized

Using old pyarmor commands with new license

Please using Pyarmor 8 commands to obfuscate the scripts

HTTP Error 503: Service Temporarily Unavailable

Invoking too many register command in 1 minute

For security reason, the license server only allows 3 register request in 1 minute

unknown license type OLD

Using old license in Pyarmor 8, the old license only works for Pyarmor 7.x

Here are the latest licenses

Please use pyarmor-7 or downgrade pyarmor to 7.7.4

This code has been used too many times If this code is used in CI/Docker pipeline, please send order information by registration email of this code to pyarmor@163.com to unlock it. Do not send this code only, it doesn’t make sense.

3.5.2. Runtime Errors

Error messages reported by pyarmor

If it has an error code, it could be customized.

Table-2. Runtime Errors of Obfuscated Scripts
Error Code Error Message Reasons
  error code out of range Internal error
error_1 this license key is expired  
error_2 this license key is not for this machine  
error_3 missing license key to run the script  
error_4 unauthorized use of script  
error_5 this Python version is not supported  
error_6 the script doesn’t work in this system  
error_7 the format of obfuscated script is incorrect
  1. the obfuscated script is made by other Pyarmor version
  2. can not get runtime package path
error_8 the format of obfuscated function is incorrect  
  RuntimeError: Resource temporarily unavailable

When using option -e to obfuscate the script, the obfuscated script need connect to NTP server to check expire date. If network is not available, or something is wrong with network, it raises this error.

Solutions:

  1. use local time if device is not connected to internet.
  2. try it again it may works.

Error messages reported by Python interpreter

Generally they are not pyarmor issues. Please consult Python documentation or google error message to fix them.

Table-2.1 Other Errors of Obfuscated Scripts
Error Message Reasons
ImportError: attempted relative import with no known parent package
  1. from .pyarmor_runtime_000000 import __pyarmor__

    Do not use -i or --prefix if you don’t know what they’re doing.

For all the other relative import issue, please check Python documentation to learn about relative import knowledge, then check Pyarmor Man Page to understand how to generate runtime packages in different locations.

3.5.3. Outer Errors

Here list some outer errors. Most of them are caused by missing some system libraries, or unexpected configuration. It need nothing to do by Pyarmor, just install necessary libraries or change system configurations to fix the problem.

By searching error message in google or any other search engine to find the solution.

  • Operation did not complete successfully because the file contains a virus or is potentially unwanted software question

    It’s caused by Windows Defender, not Pyarmor. I’m sure Pyarmor is safe, but it uses some techniques which let anti-virus tools make wrong decision. The solutions what I thought of

    1. Check documentation of Windows Defender
    2. Ask question in MSDN
    3. Google this error message
  • Library not loaded: ‘@rpath/Frameworks/Python.framework/Versions/3.9/Python’

    When Python is not installed in the standard path, or this Python is not Framework, pyarmor reports this error. The solution is using install_name_tool to change pytransform3.so. For example, in anaconda3 with Python 3.9, first search which CPython library is installed:

    $ otool -L /Users/my_username/anaconda3/bin/python
    

    Find any line includes Python.framework, libpython3.9.dylib, or libpython3.9.so, the filename in this line is CPython library. Or find it in the path:

    $ find /Users/my_username/anaconda3 -name "Python.framework/Versions/3.9/Python"
    $ find /Users/my_username/anaconda3 -name "libpython3.9.dylib"
    $ find /Users/my_username/anaconda3 -name "libpython3.9.so"
    

    Once find CPython library, using install_name_tool to change and codesign it again:

    $ install_name_tool -change @rpath/Frameworks/Python.framework/Versions/3.9/Python /Users/my_username/anaconda3/lib/libpython3.9.dylib /Users/my_username/anaconda3/lib/python3.9/site-packages/pyarmor/cli/core/pytransform3.so
    $ codesign -f -s - /Users/my_username/anaconda3/lib/python3.9/site-packages/pyarmor/cli/core/pytransform3.so