You are probably right. It's too much hacky. I ended up reading the
script and executing using 'exec'

What I am trying to do is keep independent stand alone scripts which
does something useful. However when copied into a particular directory
location under on application(django web app), the application should
be able to execute them as they are standalone and use the output.

It would be great if somebody points me to proper direction on how to
implement something like this, given this app here is django?

On Jan 26, 10:36 pm, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> On 1/26/07, Manish Singh <[EMAIL PROTECTED]> wrote:
>
> > I have this sample snippet, which works find when run from command 
> > lineUnless I misunderstand how Python handles imports, they're added to
> sys.modules, a dict, and keyed by the module name.
>
> You're repeatedly importing modules named "parse" and abusing sys.path
> and reload to do it.  I guess you're counting on side-effects of
> module initialization to do something useful?  Wow, that's a
> tremendous hack.
>
> I think you'd be much better off resolving the given paths into python
> "module.naming", adding common root dirs to sys.path as needed, and
> using __import__.  That could still be dangerous, unless the given
> dirs are sandboxes, so you might want to use imp.find_module 
> instead.http://docs.python.org/lib/module-imp.html
>
> If this has something to do with Django, I'd be surprised.  You're
> lucky you blew of your leg early.  :)


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