Tevon Strand-Brown
Tevon Strand-Brown

Reputation: 1708

What is the best user-friendly way to package up a python script into an executable?

I'm new to python and am writing a web scraping script for some coworkers that will scrape data off of a given webpage and package up into a .csv for them. What is the best way to package up this script so that they can just click on it and maybe enter some search terms then let it run and produce a .csv?

Thanks! Let me know if any clarification is needed, this is my first question!

Upvotes: 3

Views: 2485

Answers (2)

Bedi Egilmez
Bedi Egilmez

Reputation: 1542

A better solution would be taking arguments while running your python script. The only parameter would be the url of the target webpage. Check this SO answer for getting parameters.

My approach would be creating a simple HTML page that has a textbox takes target url, when user hits scrape button, it would trigger .py script, return csv file in the same directory. Check this out. You can archive it and email coworkers. Make sure that owner of the script is current user that is running OS.

Upvotes: 1

dudenr33
dudenr33

Reputation: 1169

For Windows:

If your coworkers have Python itself installed, you could simply write a simple batch script which executes

python myscript.py

You can then provide them the *.py and *.bat file.

If you want to build an *.exe from your Python script, take a look at PyInstaller. I found it fairly easy to use and it has a good documentation. It also offers the ability to package your application into a single file, and your coworkers don't have to install Python itself.

For Linux:

Add a shebang in the first line of your script to make it executable, see this StackOverflow question.

Upvotes: 0

Related Questions