Creating a sub folder in the pythons LIB Directory

T

tedpottel

Hi,

I am creating a library of functions. I would like to have them saved
in a sub folder of pythons LIB folder, but I cannot get it to work.

I have a script called test.py
I stored it in LIB folder and typed
Import test, work fine.
I store the script in lib/ted
Then type
Import lib\ted
I get a error that says invalid token, how do I do this????
 
G

Gre7g Luterman

Hi,

I am creating a library of functions. I would like to have them saved
in a sub folder of pythons LIB folder, but I cannot get it to work.

I have a script called test.py
I stored it in LIB folder and typed
Import test, work fine.
I store the script in lib/ted
Then type
Import lib\ted

Try "import ted.test" or "from ted import test". I also recommend reading
http://www.python.org/doc/essays/packages.html as it explains how to use
__init__.py files.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top