So I have been working on a directory and have not really been able to get it off the ground. As a matter of fact none at all.

import H:\Python Helpful Programs\DivisibleBy.py 

(also: everything is in the same folder)
I have also tried just DivisibleBy.py and some others. The error returned is that "EOL while scanning string literal"
Any tips or ideas?

Recommended Answers

All 3 Replies

You do not use full path name nor the .py extension. The file must be at system search path or path pointed by PYTHONPATH environment variable.

Add the directory to your path then use import program_name. To add it permanently add
export PYTHONPATH=$PYTHONPATH:/new/directory/name
to your .bash.rc file. To add it for this program

sys.path.append("/add/this/directory")

See this tutorial Click Here

Ahh, problem was elsewhere. Not a problem with path :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.