LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   modifying a python2 program installed by deb package. -- How to get *.pyc files? (https://www.linuxquestions.org/questions/debian-26/modifying-a-python2-program-installed-by-deb-package-how-to-get-%2A-pyc-files-4175612031/)

kaz2100 08-15-2017 09:29 PM

modifying a python2 program installed by deb package. -- How to get *.pyc files?
 
Hya,

System Debian (amd64) buster. Both python2 and python3 are installed.

Situation I'd like to modify 'bibus' program, which is installed by debian package. This is a program written in python2. I found several lines to modify in *.py files. These files were edited by root privilege. I want to compile these modules. Running the program with user privilege did not take care of this issue.

It looks like that *pyc modules are compiled after installation by postinst script.
Code:

...
# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
        pycompile -p bibus /usr/share/bibus -V 2.5-
fi

# End automatically added section

Question Is it safe to "pycompile" as the script above, when python3 is also installed?

Closing remark I will appreciate any information. Have a happy penguin!

pan64 08-16-2017 12:51 AM

pyc files are usually generated by the python executable itself, you do not need to take care about that.
In your case the pyc files cannot be saved, so python will always recompile py files and will not use pyc files.

kaz2100 03-02-2019 07:39 PM

It looks like (so far no trouble), pycompile works.


All times are GMT -5. The time now is 03:01 PM.