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%[email protected]>
> .
> 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