Importing My Own Script

Victor Subervi victorsubervi at gmail.com
Thu Apr 17 15:32:06 EDT 2008


That worked. Thanks.
Victor

On Thu, Apr 17, 2008 at 2:18 PM, Raúl Gómez C. <nachogomez at gmail.com> wrote:

> Victor, you can do this in order to load your own modules:
>
> import sys,os
> sys.path.append(os.getcwd())
>
> import your_module
>
>
>
>   On Fri, Apr 18, 2008 at 12:34 PM, Ben Kaplan <bskaplan14 at yahoo.com>
> wrote:
>
> >    It might be something in mod python. Try asking on their mailing
> > list.
> >
> >  ----- Original Message ----
> > From: Victor Subervi <victorsubervi at gmail.com>
> >  To: Ben Kaplan <bskaplan14 at yahoo.com>
> > Cc: python-list at python.org
> > Sent: Thursday, April 17, 2008 10:47:34 AM
> > Subject: Re: Importing My Own Script
> >
> > On Thu, Apr 17, 2008 at 8:52 AM, Ben Kaplan <bskaplan14 at yahoo.com>
> > wrote:
> >
> > >  If x and y are in the same directory, just do "import x". If not, add
> > > the directory containing x to sys.path. Then, "import x" should work.
> > >
> >
> > Well, now that´s what I thought! But no, it doesn´t work! Both scripts
> > are in the same folder. Here´s the error:
> >
> > [Thu Apr 17 07:45:50 2008] [error] [client 190.166.0.245] PythonHandler
> > mod_python.cgihandler: File "/var/www/vhosts/
> > livestocksling.com/httpdocs/bre/test.py", line 3, in ?\n import test2
> > [Thu Apr 17 07:45:50 2008] [error] [client 190.166.0.245] PythonHandler
> > mod_python.cgihandler: ImportError: No module named test2
> > I´m running through Plesk, if that makes a difference.
> > TIA,
> > Victor
> >
> >
> > >
> > > ----- Original Message ----
> > > From: Victor Subervi <victorsubervi at gmail.com>
> > > To: python-list at python.org
> > > Sent: Thursday, April 17, 2008 9:45:10 AM
> > > Subject: Importing My Own Script
> > >
> > > Hi:
> > > How do I import my own script from a second script? That is, I have
> > > script x and I want to import script y. How?
> > > TIA,
> > > Victor
> > >
> > >
> > > ------------------------------
> > > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
> > > it now.<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ>
> > >
> >
> >
> >
> > ------------------------------
> > Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
> > it now.<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ>
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
>
>
> --
> Nacho
> Linux Counter #156439
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080417/767c56e5/attachment-0001.html>


More information about the Python-list mailing list