Hi,

I have an issue where I get an exception in scan_code_for_ctypes.
Running Ubuntu 10.04, and I get the same result with both pyinstaller
1.4 and 1.5-rc1. The exception I get is:

Traceback (most recent call last):
  File "/opt/pyinstaller-1.5-rc1/Build.py", line 1459, in <module>
    main(args[0], configfilename=opts.configfile)
  File "/opt/pyinstaller-1.5-rc1/Build.py", line 1437, in main
    build(specfile)
  File "/opt/pyinstaller-1.5-rc1/Build.py", line 1394, in build
    execfile(spec)
  File "mucs.spec", line 3, in <module>
    pathex=['/opt/mucs'])
  File "/opt/pyinstaller-1.5-rc1/Build.py", line 326, in __init__
    self.__postinit__()
  File "/opt/pyinstaller-1.5-rc1/Build.py", line 277, in __postinit__
    self.assemble()
  File "/opt/pyinstaller-1.5-rc1/Build.py", line 395, in assemble
    analyzer.analyze_script(script)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 572, in analyze_script
    return self.analyze_r('__main__')
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 466, in analyze_r
    newnms = self.analyze_one(name, nm, imptyp, level)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 525, in analyze_one
    mod = self.doimport(nm, ctx, fqname)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 587, in doimport
    mod = parent.doimport(nm)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 761, in doimport
    mod = self.subimporter.getmod(nm)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 355, in getmod
    mod = owner.getmod(nm)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 148, in getmod
    mod = self._modclass()(nm, pth, co)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 725, in __init__
    self.scancode()
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 728, in scancode
    self.imports, self.warnings, self.binaries, allnms =
scan_code(self.co)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 950, in scan_code
    ctypesb, ctypesw = scan_code_for_ctypes(co, instrs, i)
  File "/opt/pyinstaller-1.5-rc1/mf.py", line 1041, in
scan_code_for_ctypes
    if bin != os.path.basename(bin):
  File "/usr/lib/python2.6/posixpath.py", line 111, in basename
    i = p.rfind('/') + 1
AttributeError: 'NoneType' object has no attribute 'rfind'


I "fixed" this by adding the following in mf.py at line 1037 (in 1.5-
rc1):

    for bin in list(b):
+        if not bin:
+            b.remove(bin)
+            continue
        if bin != os.path.basename(bin):
            b.remove(bin)
            w.append("W: ignoring %s - ctypes imports only supported
using bare filenames" % (bin,))

Not sure if this is a problem with my setup or what, but somehow, None
is getting down to that and it's causing the exception. Should this
patch be added, or is there something I should do on my end to fix it
(the traceback doesn't really tell me anything about the origin of the
problem, unfortunately).

Thanks,

Robby

-- 
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.

Reply via email to