Dalhoumi Jasser
Dalhoumi Jasser

Reputation: 3

My setup.py can't define the script when I try to install it

I've been trying to learn Python via "Learn Python the Hard Way", and in ex46 he told us to put a script in bin and install it with setup.py.

My script's name was testscript3.py:

from test3 import printstring

printstring.printstring("this is a test")

test3.py was like that:

def printstring(s='you did not provide string'):
    print s

After making them I added the script to the setup.py:

'scripts': [bin/testscript3.py],

and in PowerShell I wrote:

python setup.py install

in order to install it, but I got an error:

testscript3 is not defined

I tried to import it by doing:

from bin import testscript3

but still getting the same problem.

Upvotes: 0

Views: 32

Answers (1)

Alexis Tyler
Alexis Tyler

Reputation: 939

You need to use a string in your setup.py The reason you're getting testscript3 is not defined is because without the quotes around bin/testscript3.py Python expects bin/testscript3.py to be a variable.

'scripts': ['bin/testscript3.py'],

Upvotes: 1

Related Questions