[Python-talk] Modules force recompilation?

Bruce Labitt bruce.labitt at myfairpoint.net
Sat Feb 6 15:33:08 EST 2010


Lloyd Kvam wrote:
> On Sat, 2010-02-06 at 12:34 -0500, Bruce Labitt wrote:
>   
>> Reload doesn't seem to alway do what one expects...
>>
>> What then is a good way to force the recompilation and module cache
>> flush?
>>     
>
> I'm not sure what to suggest.  It seems you are using the reload
> function since you mention it.
>
> In [26]: import resv_saledetails as rsd
>
> In [27]: reload(rsd)
> Out[27]: <module 'resv_saledetails' from
> '/home/lkvam/vpark/purchase/resv_saledetails.pyc'>
>
> In [28]: !touch resv_saledetails.py
>
> In [29]: reload(rsd)
> Out[29]: <module 'resv_saledetails' from
> '/home/lkvam/vpark/purchase/resv_saledetails.py'>
>
> You can see that the second reload (#29) loaded from the source file.
>
> What goes wrong for you when you use reload?
>
>
>
>   
What seems to go wrong is me not using reload properly :-[
I did not know one reloads as rsd rather than resv_saledetails ...

I did not see that in the documentation when I looked.

If one edits the file outside of ipython, will ipython know the file has 
been touched?

-Bruce



More information about the Python-talk mailing list