Reputation: 338
I am trying to import a module in python that contains the following lines:
#setup.py
def isnumber(pause):
try:
float(pause)
return True
except ValueError:
return False
I am trying to call it like this:
#program.py
import setup
but I get the following error:
Traceback (most recent call last):
File "C:\Users\[email protected]\ralph\programas\python\scraper\release\program.py", line 4, in <module>
import setup
File "C:\Users\[email protected]\ralph\programas\python\lib\setup.py", line 55, in <module>
download_url="http://www.crummy.com/software/BeautifulSoup/download/"
File "C:\Users\[email protected]\ralph\programas\python\lib\distutils\core.py", line 140, in setup
raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg
SystemExit: usage: program.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: program.py --help [cmd1 cmd2 ...]
or: program.py --help-commands
or: program.py cmd --help
error: no commands supplied
Line 55 in setup.py corresponds to return True
in the code above.
Without the isnumber function the import works as expected.
Can anyone see what I'm doing wrong?
Upvotes: 1
Views: 487
Reputation: 799230
You've decided to call your module "setup.py". This is a dangerous name to pick since it's commonly used for the build/install script for Python modules, much like the one yours already has. Pick a different name.
Upvotes: 2