On 05/02/2007 23.16, Artie wrote:

> I am using PyInstaller 1.3.  My python program uses PyOpenGL.  I have
> PyOpenGL version 2.0.2.01 installed.  My os is Linux.  When I run the
> Build.py script on my program, I get this error:

The problem is that __init__.py contains DOS line endings (\r\n). This does 
not seem to affect normal execution with Python, but confuses PyInstaller. In 
fact, it is even documented that compile() does not accept "\r\n" line endings.

I have just committed the attached patch as r306. Can you get it off SVN trunk 
and verify it fixes the problem for you?

Thanks!
-- 
Giovanni Bajo


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/PyInstaller?hl=en
-~----------~----~----~----~------~----~------~--~---

Index: mf.py
===================================================================
--- mf.py	(revision 305)
+++ mf.py	(working copy)
@@ -68,7 +68,8 @@
         while 1:
             if pyc is None or py and pyc[1][8] < py[1][8]:
                 try:
-                    co = compile(open(py[0], 'r').read()+'\n', py[0], 'exec')
+                    stuff = open(py[0], 'r').read()+'\n'
+                    co = compile(string.replace(stuff, "\r\n", "\n"), py[0], 'exec')
                     if __debug__:
                         pth = py[0] + 'c'
                     else:
@@ -179,7 +180,8 @@
                 return ExtensionModule(nm, fnm)
             elif typ == imp.PY_SOURCE:
                 try:
-                    co = compile(open(fnm, 'r').read()+'\n', fnm, 'exec')
+                    stuff = open(fnm, 'r').read()+'\n'
+                    co = compile(string.replace(stuff, "\r\n", "\n"), fnm, 'exec')
                 except SyntaxError, e:
                     print "Invalid syntax in %s" % py[0]
                     print e.args
@@ -369,7 +371,8 @@
 
     def analyze_script(self, fnm):
         try:
-            co = compile(open(fnm, 'r').read()+'\n', fnm, 'exec')
+            stuff = open(fnm, 'r').read()+'\n'
+            co = compile(string.replace(stuff, "\r\n", "\n"), fnm, 'exec')
         except SyntaxError, e:
             print "Invalid syntax in %s" % fnm
             print e.args
Index: doc/CHANGES.txt
===================================================================
--- doc/CHANGES.txt	(revision 305)
+++ doc/CHANGES.txt	(working copy)
@@ -8,6 +8,8 @@
    Aykun).
  * Removed C++-style comments from the bootloader for compatibility
    with the AIX compiler.
+ + Fix support for .py files with DOS line endings under Linux (fixes
+   PyOpenGL).
 
 
 PyInstaller 1.3

Reply via email to