-2

We're working on a python application for MAC OSX that should be pip-installable, and we want to automate the creation of a plist file during installation, but the file name must contain the OSX username in order for the application to work, eg. com.username.app.plist.

Q : How do I dynamically generate such a file in python ?

imadhsissou
  • 575
  • 5
  • 14

1 Answers1

2

Since you just need the username:

import getpass
user = getpass.getuser()
fname = "com.strange.things." + user + ".more.strange.things"
Marcus Müller
  • 27,924
  • 4
  • 40
  • 79