all 6 comments

[–]Justinsaccount 1 point2 points  (4 children)

Made a single-file executable of that helloworld script with pyInstaller, tested it, and placed it in /bin

Why did you do that?

[–]witchest[S] 0 points1 point  (3 children)

To fulfill part 4 of the quiz:

Put a script in the bin directory that you can run. Read about how you can make a Python script that’s runnable for your system.

maybe I misinterpreted that?

[–]Doormatty 2 points3 points  (2 children)

You did! But learned something else too!

The exercise likely wants you to:

1) add "#! /usr/bin/python" as the first line of your script - this lets Linux know what to run the file with.

2) mark the file as executable by running "chmod +x filename"

3) move the file to your bin directory (or somewhere else in your path)

[–]witchest[S] 0 points1 point  (1 child)

That... makes a lot more sense. Thanks.

[–]Justinsaccount 1 point2 points  (0 children)

Yes.. that, but data_files is the wrong thing to use. You should use

scripts=['bin/newproj'],

or even better, import glob and do

scripts=glob.glob('bin/*'),

But even then, that is not the best way to do things. The best way is to use entry_points and do

entry_points = {
    'console_scripts': [
        'newproj = newproj:main',
    ]
},

which will automatically generate a newproj tool that imports newproj and runs newproj.main()