Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
timhutton opened this issue Nov 23, 2022 · 4 comments
Open
Assignees

Comments

@timhutton
Copy link
Owner

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.

@press-rouch
Copy link
Collaborator

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.

@lenaschimmel
Copy link
Collaborator

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")

@press-rouch
Copy link
Collaborator

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.

@press-rouch
Copy link
Collaborator

@timhutton I think we can close this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants