0010 – Improving My First Script

In my last post detailing my first Python script I mentioned that I was going to work on revising the script to the point of hopefully making it useful enough to be able to pass on to co-workers without too much hassle. Going through my script again with fresh eyes, it was fascinating how much low hanging fruit there was. I truly did the bare minimum to get this script up and running for a single use case: my running the script on my machine. The script could not be less flexible. So, for my own future self looking back, here are the things I missed first time around that I am going to improve about my script.

Relatively Low Hanging Fruit

The easiest most basic fundamental thing I need to improve is setting up the script to allow arguments passed in so that it can be run standalone from a command line. Every time I used this script I ran it inside of PyCharm and so I just hardcoded in a lot of the variables that really should be arguments passed in by the user:

  • FTP credentials[1]
  • Download location/folder structure
  • Which version to check[2]

I also would like to add some features that would be arguments to pass in, like an option to install or not install after download and an option to also download the Windows build as well since that is just a small change in the path on the server.

Given that the downloads can be a few gigabytes, I also desperately need some kind of download progress. All I had to go on when writing this was watching iStat Menus’ network monitor and seeing that a download was happening. Another easy feature would be to unmount the disk image after installation is complete. I also noticed I have two places in my script where I have the same FTP login code; that obviously should be encapsulated to it’s own function and just called to.

Errors To Handle

Obviously as a script for a relatively savvy user, I’m not worried about handling all errors that a consumer-facing piece of software might. Even so, there are still some relatively common errors I should handle, like:

  • Incorrect FTP login credentials
  • Unable to find FTP[3]
  • Some kind of interruption or failure to download
  • No write permissions on the supplied download location

Big Ideas

To really take this script to a completed state I need to figure out if it relies on any Python 3 features/syntax. My target audience is Mac users and macOS still only ships with a 2.x version of Python. The easy way out would be to just ask a user to install Python 3.x, but the idealist in me thinks I should just make it 2.x complient (it may even already be).

Finally, a part of me really wants this to have a GUI element. I’m not sure yet if Python can do this, but I just would like an option to have the script present a GUI version of the command line arguments listed above so that it would be even easier to use. Granted, the audience of people I work with who might use this should have no problem with a command line argument setup, but part of my just likes a GUI.

So, all of the above is part of my KPI to complete the task of improving on my script so that it is able to be used by others. Wish me luck!


  1. I know, I know. I just had to get it working!  ↩

  2. I might be testing multiple versions of Premiere at any given time and so the script needs to know the version number to go find the latest build and download it, etc.  ↩

  3. For example, you won’t find the FTP if not on the company VPN.  ↩