My first Python tool

Though I am still studying Python, I want to share a result with you. But first, the problem I aim to tackle with my tool.
More than once have I read the following in the logical test specifications: “System X cannot handle files bigger than Y MB.” Let’s say Y=10. Of course we want to test whether 10 MB is handled well, and if not, how 9.99 MB is handled. Also, we want to check what happens when we upload 10.1 MB. But do we have such files at our disposal? No.
Thus I have created a small but helpful tool which let’s you choose the following:

  • file size, in our example it would be 10 or 9.99 (note the dot)
  • file name, if empty “untitled”
  • file extension: .txt, .pdf, .xml, .zip, defaults to .txt
  • MB or MiB, defaults to MB

The output is an empty file of exactly the size you want! Opening the file, however, is ill-advised. I created a text file of 1 GB, opened it, and my text editor did not appreciate that. One question remains unanswered: “Which requested file size will make my tool crash?” I’ll leave the answering to you 🙂

Tagged on: ,

Leave a Reply

Your email address will not be published. Required fields are marked *