Is the small change mentioned in this thread worth incorporating?  My
personal opinion is that it is, because it makes sure that (in this
area anyway) the frozen executable behaves just like the live script.

On Nov 15, 11:01 am, dhyams <[email protected]> wrote:
> I keep adding stuff to this post, sorry!
>
> I can (and do, now) generate the the .pyo files myself just before I
> import; it was an easy thing to add...but, shouldn't the importer just
> do this automatically?  Or is there some reason why it would not be
> desirable to do so?
>
> I'm only coming at this from a standpoint of keeping the behavior of a
> frozen executable as close as possible to the script when it is
> running live.
>
> On Nov 15, 1:55 am, Daniel Hyams <[email protected]> wrote:
>
>
>
>
>
>
>
> > And as a follow up to this, is there a straightforward way to get the
> > importer to generate the .pyc files as it imports modules, like the standard
> > Python import mechanism?
>
> > On Mon, Nov 15, 2010 at 1:43 AM, dhyams <[email protected]> wrote:
> > > [SOLVED]
>
> > > I finally tracked this down to the directory caching in iu.py.  This
> > > function:
>
> > >    def _listdir(dir, cache={}):
> > >        # since this function is only used by caseOk, it's fine to
> > > cache the
> > >        # results and avoid reading the whole contents of a directory
> > > each time
> > >        # we just want to check the case of a filename.
> > >        if not dir in cache:
> > >            cache[dir] =listdir(dir)
> > >        return cache[dir]
>
> > > I tried modifying it to the following, but it still wasn't
> > > enough....the file additions and
> > > imports were happening fast enough that sometimes the modification
> > > time didn't change
> > > from one to the other.
>
> > >    def _listdir(dir, cache={}):
> > >        # since this function is only used by caseOk, it's fine to
> > > cache the
> > >        # results and avoid reading the whole contents of a directory
> > > each time
> > >        # we just want to check the case of a filename.
> > >        mtime = _os_stat(dir)[8]
> > >        #print("MTIME[%s] = %s",str(mtime))
> > >        if not dir in cache or mtime != cache[dir]['mtime']:
> > >            cache[dir] = {'mtime':mtime,'files':listdir(dir)}
> > >        return cache[dir]['files']
>
> > > So, I just knuckled under and just disabled the caching.  After
> > > thinking about it for
> > > a bit, I think the caching is too dangerous anyway.  The contents of a
> > > directory are
> > > volatile, and if one is going to have reliable behavior, we just have
> > > to check the directory
> > > contents in real time whenever an import is desired.  So:
>
> > >    def _listdir(dir, cache=None):
> > >        # Once upon a time there was caching here, but it's just too
> > > dangerous.
> > >        return listdir(dir)
>
> > > Works fine.
>
> > > On Nov 15, 12:28 am, Daniel Hyams <[email protected]> wrote:
> > > > Oh, and I apologize; I did not mention environment or versions.
>
> > > > Windows 7
> > > > pyinstaller 1.4 SVN grabbed tonight
> > > > Python 2.6.x
>
> > > > On Sun, Nov 14, 2010 at 11:53 PM, dhyams <[email protected]> wrote:
> > > > > Hello all; I have been beating my head against this one for a
> > > > > while...there seems to be strange import behavior when the application
> > > > > is in its 'frozen' state.
>
> > > > > ...
>
> > > --
> > > 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]<pyinstaller%2bunsubscr...@googlegr
> > >  oups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/pyinstaller?hl=en.
>
> > --
> > Daniel Hyams
> > [email protected]

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