Skip to content

Instantly share code, notes, and snippets.

@MahmudHasanCSE
Last active May 3, 2018 10:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MahmudHasanCSE/0a0423ba16dbca479ea75ac642900160 to your computer and use it in GitHub Desktop.
Save MahmudHasanCSE/0a0423ba16dbca479ea75ac642900160 to your computer and use it in GitHub Desktop.
import os
import configparser # configparser to read the profiles.ini file in to determine which folder to use
mozilla_profile = os.path.join(os.getenv('APPDATA'), r'Mozilla\Firefox')
mozilla_profile_ini = os.path.join(mozilla_profile, r'profiles.ini')
profile = configparser.ConfigParser()
profile.read(mozilla_profile_ini)
data_path = os.path.normpath(os.path.join(mozilla_profile, profile.get('Profile0', 'Path')))
# os.path.normpath() is used to ensure backslashes are used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment