On Tue, 2008-02-12 at 17:41 -0800, Julien wrote:
> Hi!
> 
> I can't try this out at the moment as I don't have access to the code.
> But I just thought I'd add the fact that forms.py is never compiled
> (no trace of a forms.pyc). Should the __import__ function force the
> compilation of a module when it's imported, or does it require that
> module to be compiled prior (and if so, how can you force that
> compilation)?

The .pyc file thing is a red herring here. Python will byte compile
files it imports and save them to disk, if it can (i.e. if it has write
permission). However, if it cannot do so, no problems, it's just a bit
slower the next time (because it has to recompile).

So if you're in a position where a .pyc file loads and the
corresponding .py file does not, something is seriously messed up. I
doubt that's going on.

That would lend evidence to my wondering if you are running the
__import__ statement from something that is being imported by forms.py
(so forms.py hasn't finished importing at the time you execute that line
and, thus, forsm.MyModelForm wouldn't exist).

Still, a quick test here shows that __import__ does save the .pyc file
when the calling process had write-permission to the directory I was
importing from.

Regards,
Malcolm

-- 
Quantum mechanics: the dreams stuff is made of. 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to