Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pyc compile error
#1
Hi
not enough information online - so i ask it here.
the issue:
i have a .py script that run fine on gimp.
when trying to compile it with "-m compileall" - i get an error:
#########################################
Error processing line 3 of c:\Program Files\GIMP 2\Python\lib\site-packages\pygtk.pth:

  Traceback (most recent call last):
    File "c:\Program Files\GIMP 2\Python\lib\site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
  ImportError: No module named runtime

Remainder of file ignored
Compiling myscript.py ...
#################################

the compile produce a .pyc file, but when gimp trying to load it - it crash with similar error or 
"runtime" module missing... 

I was trying to compile other gimp python scripts  - with same result.
i remember that in ubuntu i tried it once , few months ago, and it was fine.

can someone help with this issue?
Reply
#2
(12-13-2017, 04:00 PM)look Wrote: Hi
not enough information online - so i ask it here.
the issue:
i have a .py script that run fine on gimp.
when trying to compile it with "-m compileall" - i get an error:
#########################################
Error processing line 3 of c:\Program Files\GIMP 2\Python\lib\site-packages\pygtk.pth:

  Traceback (most recent call last):
    File "c:\Program Files\GIMP 2\Python\lib\site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
  ImportError: No module named runtime

Remainder of file ignored
Compiling myscript.py ...
#################################

the compile produce a .pyc file, but when gimp trying to load it - it crash with similar error or 
"runtime" module missing... 

I was trying to compile other gimp python scripts  - with same result.
i remember that in ubuntu i tried it once , few months ago, and it was fine.

can someone help with this issue?

On Linux, /usr/lib/python2.7/dist-packages/pygtk.pth contains

Code:
gtk-2.0

So, no line 3, no import...

What happens if you rename the file to "pygtk.pth.disabled"?

What are you trying to achieve by compiling your Python?
Reply
#3
(12-13-2017, 08:42 PM)Ofnuts Wrote:
(12-13-2017, 04:00 PM)look Wrote: Hi
not enough information online - so i ask it here.
the issue:
i have a .py script that run fine on gimp.
when trying to compile it with "-m compileall" - i get an error:
#########################################
Error processing line 3 of c:\Program Files\GIMP 2\Python\lib\site-packages\pygtk.pth:

  Traceback (most recent call last):
    File "c:\Program Files\GIMP 2\Python\lib\site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
  ImportError: No module named runtime

Remainder of file ignored
Compiling myscript.py ...
#################################

the compile produce a .pyc file, but when gimp trying to load it - it crash with similar error or 
"runtime" module missing... 

I was trying to compile other gimp python scripts  - with same result.
i remember that in ubuntu i tried it once , few months ago, and it was fine.

can someone help with this issue?

On Linux, /usr/lib/python2.7/dist-packages/pygtk.pth contains

Code:
gtk-2.0

So, no line 3, no import...

What happens if you rename the file to "pygtk.pth.disabled"?

What are you trying to achieve by compiling your Python?

I just want to obscure the code a little. nothing more.
well, to remove this line is great... but why it is compiled in first place? 
what is this file? why gimp include it?
if its a bug - need to be removed.
currently, in version 2.8.22 - can't compile any of the py scripts.
Reply
#4
If you looks at site.py, as their extension indicate the ".pth" files include modules to be added to the python path.

In the open-source word, obscured code has something to hide, and so is suspect.

Btw, looking at the code, it seems that at least the Windows version relies on file extensions to determine what can be run, and for Python this is defined by the file "lib/gimp/2.0/interpreters/pygimp.interp", that only mentions the ".py" extension. So your compiled Python will only run on altered installs, and if the file can only contain one extension using "pyc" will preclude the use of "py".
Reply


Forum Jump: