timhutton / twitter-archive-parser

Python code to parse a Twitter archive and output in various ways

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Allow double-clicking the script in a file explorer

timhutton opened this issue · comments

Double-clicking the script doesn't work on my setup (Windows). The output window appears and disappears immediately. It would be nice if we could allow the script to be double-clicked from a GUI.

Adding this line to the top of main is the simplest fix:
os.chdir(os.path.dirname(__file__))
It might also be nice to have a optional command line argument for running on a different directory, if you have multiple archives and don't want to copy the script around.

I'm already running this script in multiple directories without copying it, simply by:

cd "/Users/lena/Desktop/Goodbye Twitter/Archive/twitter-lenaschimmel-2022-11-12"
python3 /Users/lena/src/twitter-archive-parser/parser.py

I think this way of using it would break when that line is added. How can we get both to work?

Maybe:

  • look in current dir if it is an archive
  • if it's not, look in the dir of the script, if that dir is also an archive
  • if both is not an achive, print an error message
  • do something to prevent the terminal window from closing instantly, so that the user can actually read the error message. Waiting for input would certainly help?
  • Instead of just saying "Please press enter to exit" it could also say something like "Please enter the path of your Twitter archive, or just press Enter to exit. On most operating systems, you an also try to drag and drop your archive folder into the terminal window, and it will paste its path automatically." (according to this answer on SO, "this useful feature went away in Windows Vista and Windows Server 2008, but has come back in Windows 7")

Good plan. I've confirmed that drag and drop of directory from Windows Explorer onto Python executable window, Command Prompt, Powershell, and Windows Terminal works in Windows 10.

@timhutton I think we can close this now.