Hi,

Sorry Giovanni ... I just assumed that imp was the best way of doing
it. However, I've done a little test and it looks like it'll work.
I'll go through the code and change it.

Thanks for your help.

ALJ

On Nov 18, 3:07 pm, Giovanni Bajo <[EMAIL PROTECTED]> wrote:
> On Mon, 2008-11-17 at 13:15 -0800, Astley Le Jasper wrote:
> > Hi Giovanni,
>
> > Thanks for your help.
>
> > I have a number of site specific scraping scripts that are managed
> > from a management script. The later is along the lines of:
>
> > import imp
> > import threading
>
> > site_script_list = ('google','bbc','ebay','amazon')
> > thread_dict = {}
> > search_str = "something"
>
> > for site in site_script_list:
> >     thread_list[site]=threading.Thread(name=site, target=run_all, args=
> > (site,))
> >     thread_list[site].start()
>
> > for site in thread_dict:
>
> >     thread_list[site].join()
>
> > def run_all(site):
> >     f, filename, description = imp.find_module(site)
>
> >     sitemodule = imp.load_module(site, f, filename, description)
> >     results = sitemodule.get_search_results(search_str)
> >     archiveresults(results)
> >     etc etc ......
> > Obviously it's a bit more complicated than this but it'll gives you
> > the general idea.
>
> I must be missing something: why don't you simply import all the
> required modules and then use them?
>
> ===========================================================================
> import site_google
> import site_ebay
> import site_bbc
>
> site_names = [name for name in sorted(globals()) if name.startswith("site_")]
> sites = [globals()[d] for d in site_names]
>
> for s in sites:
>     run_all(s)
>
> def run_all(site):
>     site.get_search_results(...)
>     [...]
> ===========================================================================
>
> You still need to mention each site exactly once, but that's what you're
> already doing AFAICT.
>
> --
> Giovanni Bajo
> Develer S.r.l.http://www.develer.com
--~--~---------~--~----~------------~-------~--~----~
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