OT - strange import problem with py2exe'd app

Sorry for the OT post - this is a really weird problem and I am not sure which list to use.

On a button event I do this:

            import frameplotmpl as plot
            self.Charts = plot.PlotFrame(parent=self)

I do not get any errors on the import line, but after that I get:

'module' object has no attribute 'PlotFrame'

I tested the same installer on different machines and it always works, except for this one customer.

I added a "print dir(plot)" and the customer sees this:

['__builtins__', '__doc__', '__file__', '__loader__', '__name__', 'arange', 'matplotlib', 'pi', 'sin', 'sys', 'twcbcopyright', 'wx']

Following is the beginning of frameplotmpl, looking at it and the above output there seems to be something going wrong after the line of "import matplotlib", but there is no exception.

Looking at this now I guess I should ask on the matplotlib list too.

Any hints would really be appreciated - finding the issue is even more complicated as I don't have access to the customers machine.

Werner

"start of framplotmpl"

import twcbcopyright
import wx
import wx.lib.masked.numctrl

import sys
if not hasattr(sys, 'frozen'):
    import pkg_resources
    pkg_resources.require("pytz") # get latest version

from numpy import arange, sin, pi
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.dates import YearLocator, MonthLocator, DateFormatter
from matplotlib.ticker import FormatStrFormatter
from matplotlib.font_manager import FontProperties

from matplotlib.colors import cnames as cNames

del cNames['black']

monthsFmt = DateFormatter('%b')

Hi Werner,

···

On Sat, Dec 12, 2009 at 4:03 AM, werner wbruhin@free.fr wrote:

Sorry for the OT post - this is a really weird problem and I am not sure

which list to use.

On a button event I do this:

        import frameplotmpl as plot

        self.Charts = plot.PlotFrame(parent=self)

I do not get any errors on the import line, but after that I get:

‘module’ object has no attribute ‘PlotFrame’

I tested the same installer on different machines and it always works,

except for this one customer.

I added a “print dir(plot)” and the customer sees this:

[‘builtins’, ‘doc’, ‘file’, ‘loader’, ‘name’,

‘arange’, ‘matplotlib’, ‘pi’, ‘sin’, ‘sys’, ‘twcbcopyright’, ‘wx’]

Following is the beginning of frameplotmpl, looking at it and the above

output there seems to be something going wrong after the line of "import

matplotlib", but there is no exception.

Looking at this now I guess I should ask on the matplotlib list too.

Any hints would really be appreciated - finding the issue is even more

complicated as I don’t have access to the customers machine.

Werner

“start of framplotmpl”

import twcbcopyright

import wx

import wx.lib.masked.numctrl

import sys

if not hasattr(sys, ‘frozen’):

import pkg_resources

pkg_resources.require("pytz") # get latest version

from numpy import arange, sin, pi

import matplotlib

matplotlib.use(‘WXAgg’)

from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as

FigureCanvas

from matplotlib.backends.backend_wx import NavigationToolbar2Wx

from matplotlib.dates import YearLocator, MonthLocator, DateFormatter

from matplotlib.ticker import FormatStrFormatter

from matplotlib.font_manager import FontProperties

from matplotlib.colors import cnames as cNames

del cNames[‘black’]

monthsFmt = DateFormatter(‘%b’)

That does sound pretty weird. Does the number of files installed match the number that it should be? I wonder if he has some antivirus/anti-malware software installed that is deleting a *.pyc file or something.


Mike Driscoll

Blog: http://blog.pythonlibrary.org

Hi Mike,

Mike Driscoll wrote:

Hi Werner,

Sorry
for the OT post - this is a really weird problem and I am not sure

which list to use.

On a button event I do this:

       import frameplotmpl as plot

       self.Charts = plot.PlotFrame(parent=self)

I do not get any errors on the import line, but after that I get:

‘module’ object has no attribute ‘PlotFrame’

I tested the same installer on different machines and it always works,

except for this one customer.

I added a “print dir(plot)” and the customer sees this:

[‘builtins’, ‘doc’, ‘file’, ‘loader’, ‘name’,

‘arange’, ‘matplotlib’, ‘pi’, ‘sin’, ‘sys’, ‘twcbcopyright’, ‘wx’]

Following is the beginning of frameplotmpl, looking at it and the above

output there seems to be something going wrong after the line of "import

matplotlib", but there is no exception.

Looking at this now I guess I should ask on the matplotlib list too.

Any hints would really be appreciated - finding the issue is even more

complicated as I don’t have access to the customers machine.

Werner

“start of framplotmpl”

import twcbcopyright

import wx

import wx.lib.masked.numctrl

import sys

if not hasattr(sys, ‘frozen’):

import pkg_resources

pkg_resources.require(“pytz”) # get latest version

from numpy import arange, sin, pi

import matplotlib

matplotlib.use(‘WXAgg’)

from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as

FigureCanvas

from matplotlib.backends.backend_wx import NavigationToolbar2Wx

from matplotlib.dates import YearLocator, MonthLocator, DateFormatter

from matplotlib.ticker import FormatStrFormatter

from matplotlib.font_manager import FontProperties

from matplotlib.colors import cnames as cNames

del cNames[‘black’]

monthsFmt = DateFormatter(‘%b’)

That does sound pretty weird. Does the number of files installed match
the number that it should be?
Good point, will find out.
I wonder if he has some antivirus/anti-malware software
installed that is deleting a *.pyc file or something.
I wondered to about virus/firewall settings, but it is really weird
that no exception is thrown.

Werner

···

On Sat, Dec 12, 2009 at 4:03 AM, werner wbruhin@free.fr > wrote:

Hi Mike,

Mike Driscoll wrote:

Hi Werner,

Sorry for the OT post - this is a really weird problem and I am not sure

which list to use.

On a button event I do this:

           import frameplotmpl as plot
           self.Charts = plot.PlotFrame(parent=self)

I do not get any errors on the import line, but after that I get:

'module' object has no attribute 'PlotFrame'

I tested the same installer on different machines and it always works,

except for this one customer.

I added a "print dir(plot)" and the customer sees this:

['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
'arange', 'matplotlib', 'pi', 'sin', 'sys', 'twcbcopyright', 'wx']

Following is the beginning of  frameplotmpl, looking at it and the above
output there seems to be something going wrong after the line of "import
matplotlib", but there is no exception.

Looking at this now I guess I should ask on the matplotlib list too.

Any hints would really be appreciated - finding the issue is even more
complicated as I don't have access to the customers machine.

Werner

“start of framplotmpl”

import twcbcopyright

import wx
import wx.lib.masked.numctrl

import sys

if not hasattr(sys, ‘frozen’):
import pkg_resources
pkg_resources.require(“pytz”) # get latest version

from numpy import arange, sin, pi
import matplotlib
matplotlib.use(‘WXAgg’)
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as
FigureCanvas
from matplotlib.backends.backend_wx import NavigationToolbar2Wx
from matplotlib.dates import YearLocator, MonthLocator, DateFormatter
from matplotlib.ticker import FormatStrFormatter
from matplotlib.font_manager import FontProperties

from matplotlib.colors import cnames as cNames

del cNames[‘black’]

monthsFmt = DateFormatter('%b')

That does sound pretty weird. Does the number of files installed match the number that it should be?
Good point, will find out.
I wonder if he has some antivirus/anti-malware software installed that is deleting a *.pyc file or something.
I wondered to about virus/firewall settings, but it is really weird that no exception is thrown.

Werner

The other possibility is that that one customer has a module called frameplotmpl on his machine from somewhere/one else.

If it is being found by the import algorithm before the one you need…

Gadget Steve

···

From: werner

Sent: Saturday, December 12, 2009 1:42 PM

To: wxpython-users@googlegroups.com

Subject: Re: [wxPython-users] OT - strange import problem with py2exe’d app

On Sat, Dec 12, 2009 at 4:03 AM, werner wbruhin@free.fr wrote:

Steve,

GadgetSteve@live.co.uk wrote:

The other possibility is that that one customer has a module called frameplotmpl on his machine from somewhere/one else. If it is being found by the import algorithm before the one you need...

The app is py2exe'd, so I thought it does not look beyond my app folder - is this not so?

Werner

Werner,

I am not too sure - if you have used the zip option then there will be a common modules library - if you have allowed the default filename for the zipped library and there is another on the system then it may be used instead, (this is why I am reluctant to use default names for that sort of thing). Of course if this is a remote installation then it is not impossible that the user has an old library that is not being overwritten, is it possible to get them to install to a different directory?

Steve

···

--------------------------------------------------
From: "werner" <wbruhin@free.fr>
Sent: Sunday, December 13, 2009 9:53 AM
To: <wxpython-users@googlegroups.com>
Subject: Re: [wxPython-users] OT - strange import problem with py2exe'd app

Steve,

GadgetSteve@live.co.uk wrote:

The other possibility is that that one customer has a module called
frameplotmpl on his machine from somewhere/one else.
If it is being found by the import algorithm before the one you need...

The app is py2exe'd, so I thought it does not look beyond my app folder
- is this not so?

Werner

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi Steve,

GadgetSteve@live.co.uk wrote:

Werner,

I am not too sure - if you have used the zip option then there will be a common modules library - if you have allowed the default filename for the zipped library and there is another on the system then it may be used instead, (this is why I am reluctant to use default names for that sort of thing). Of course if this is a remote installation then it is not impossible that the user has an old library that is not being overwritten, is it possible to get them to install to a different directory?
  

Thanks for taking the time to think about my problem.

I use "zipfile = r'lib\library.zip'," , so I think that should be fine.

Had him rename the application folder, download again and install still the same issue. Then I created a new installer with some additional exception handling which showed me that the file is just "partially imported".

At the moment I am waiting for some feedback from the user on some more details on his setup and I also asked him to try to run the application with all virus/malware type software deactivated (recommended that he does this while disconnected from the Internet).

So, will see.

I will give an update on my findings.

Werner

Look forward to hearing the outcome.

···

--------------------------------------------------
From: "werner" <wbruhin@free.fr>
Sent: Sunday, December 13, 2009 11:08 AM
To: <wxpython-users@googlegroups.com>
Subject: Re: [wxPython-users] OT - strange import problem with py2exe'd app

Hi Steve,

GadgetSteve@live.co.uk wrote:

Werner,

I am not too sure - if you have used the zip option then there will be a
common modules library - if you have allowed the default filename for the
zipped library and there is another on the system then it may be used
instead, (this is why I am reluctant to use default names for that sort of
thing). Of course if this is a remote installation then it is not
impossible that the user has an old library that is not being overwritten,
is it possible to get them to install to a different directory?

Thanks for taking the time to think about my problem.

I use "zipfile = r'lib\library.zip'," , so I think that should be fine.

Had him rename the application folder, download again and install still
the same issue. Then I created a new installer with some additional
exception handling which showed me that the file is just "partially
imported".

At the moment I am waiting for some feedback from the user on some more
details on his setup and I also asked him to try to run the application
with all virus/malware type software deactivated (recommended that he
does this while disconnected from the Internet).

So, will see.

I will give an update on my findings.

Werner

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

There's probably a same named module being found somewhere else. Add printing plot.__file__ to see where it is being imported from. Another possibility is a circular import situation and so the module isn't fully imported when you need to use something from it.

···

On 12/12/09 2:03 AM, werner wrote:

Sorry for the OT post - this is a really weird problem and I am not sure
which list to use.

On a button event I do this:

             import frameplotmpl as plot
             self.Charts = plot.PlotFrame(parent=self)

I do not get any errors on the import line, but after that I get:

'module' object has no attribute 'PlotFrame'

I tested the same installer on different machines and it always works,
except for this one customer.

I added a "print dir(plot)" and the customer sees this:

['__builtins__', '__doc__', '__file__', '__loader__', '__name__',
'arange', 'matplotlib', 'pi', 'sin', 'sys', 'twcbcopyright', 'wx']

--
Robin Dunn
Software Craftsman