Hello,
Today I came across something that looks like a (small) bug. In my project I have a file called "Logging.py" (capital L), in the root of the project. This project imports reportlab (the reporting library). In python 3.4, it doesn't work once frozen. It gives a stacktrace during the imports. In that stacktrace, in the chain of imports, I see that reportlab imports the logging module (the one from Python I guess). But strangely, right after in the stack trace, I see that cx_freeze is in my Logging module. So I'm wondering if there's a problem when matching names of module (naming my logging module "Logging" is, of course, a bit dangerous, but that decision was taken a long time ago, when I was still learning Python :-) ) When I change the name of my "Logging.py" module to something different, like "aaa.py", then it works fine. I've reproduced this bug with two files. I put both these files in a directory called "testcx", plus an additional __init__.py Here there are : ------------------- app.py # The report lab stuff is there to trigger the imports # it can probably reduced to a few well chosen imports from reportlab import platypus from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import inch,cm from reportlab.platypus import Paragraph,BaseDocTemplate from reportlab.graphics.barcode import createBarcodeDrawing from reportlab.lib.enums import TA_CENTER,TA_RIGHT from reportlab.pdfgen import canvas from reportlab.lib.styles import ParagraphStyle import testcx.Logging s = ParagraphStyle(name = "zou", fontName = 'Helvetica') print("app") ------------------- Logging.py print("Logging module") Then I do : set PYTHONPATH=... the path that *contains* the testcx directory I freeze the app : python \PORT-STCA2\opt\python3\Scripts\cxfreeze testcx\app.py When I run : dist\app.exe I get : C:\PORT-STCA2\pl-PRIVATE\horse>dist\app.exe Logging module Traceback (most recent call last): File "C:\PORT-STCA2\opt\python3\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module> exec(code, m.__dict__) File "testcx\app.py", line 1, in <module> from reportlab import platypus File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2284, in _handle_fromlist File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 321, in _call_with_frames_removed File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible File "C:\PORT-STCA2\opt\python3\lib\site-packages\reportlab\platypus\__init__.py", line 12, in <module> from reportlab.platypus.tables import Table, TableStyle, CellStyle, LongTable File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible File "C:\PORT-STCA2\opt\python3\lib\site-packages\reportlab\platypus\tables.py", line 28, in <module> from reportlab.platypus.doctemplate import Indenter File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible File "C:\PORT-STCA2\opt\python3\lib\site-packages\reportlab\platypus\doctemplate.py", line 34, in <module> from reportlab.platypus.frames import Frame File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2237, in _find_and_load File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 2226, in _find_and_load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1191, in _load_unlocked File "c:\python\32-bit\3.4\lib\importlib\_bootstrap.py", line 1161, in _load_backward_compatible File "C:\PORT-STCA2\opt\python3\lib\site-packages\reportlab\platypus\frames.py", line 11, in <module> logger = logging.getLogger('reportlab.platypus') AttributeError: 'module' object has no attribute 'getLogger' The script works perfectly fine when run through Python interpreter... I use python 3.4.2 and cx_freeze 4.3.4 on Windows 7. Maybe this is a problem because of Windows is case insensitive on file names ? But then, why is cx_freeze's behaviour different ? Right now this is not much of a problem for me, I've just renamed my python logging module to a saner name. I've also checked cxFreeze code a bit and didn't see anything obvious. stF -- Timeo Danaos et dona ferentes Twitter : @Arakowa1 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ cx-freeze-users mailing list cx-freeze-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cx-freeze-users