-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 ?

3
  • Are you just looking to get the username from OSX? Commented Oct 8, 2016 at 20:37
  • I'm looking to create a file that contains the OSX username in it's name, like com.steven.app.plist, as of now, we should manually create the file in order for the app to work, we want to automate this task on installation ! Commented Oct 8, 2016 at 20:46
  • Which is the part you're having trouble with, getting the username or concatenating the strings? Commented Oct 8, 2016 at 20:51

1 Answer 1

2

Since you just need the username:

import getpass
user = getpass.getuser()
fname = "com.strange.things." + user + ".more.strange.things"
Sign up to request clarification or add additional context in comments.

1 Comment

that solved my problem, thanks !

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.