print("Error: Didn't have the permissions to create the config directory at {}".format(selection["path"]),file=sys.stderr)
print("Hint: Change the owner of the directory temporarily to {} or run {} config create with more permissions".format(getpass.getuser(),APPLICATION_NAME))
print(f"Error: Didn't have the permissions to create the config directory at {selection['path']}",file=sys.stderr)
print(f"Hint: Change the owner of the directory temporarily to {getpass.getuser()} or run {APPLICATION_NAME} config create with more permissions",file=sys.stderr)
print(f"Hint: The python executable used by this script is located at \"{python_path}\"",file=sys.stderr)
# Run again with priviledges
python_path=f"{sys.prefix}/bin/python3"
subprocess.call(['sudo',python_path,*sys.argv])
sys.exit()
...
...
@@ -423,12 +424,16 @@ def create_config():
try:
config_path.write_text(DEFAULT_CONFIG)
exceptPermissionErrorase:
python_path=f"{sys.prefix}/bin/python3"
print()
print(f"Error: Didn't have the permissions to write the file to {config_path}",file=sys.stderr)
print(f" Directory \"{selection['path']}\" belongs to user {selection['path'].owner()} (was running as user {getpass.getuser()})",file=sys.stderr)
print()
print(f"Hint: Change the owner of the directory temporarily to {getpass.getuser()} or run {APPLICATION_NAME} config create with more permissions")
exit()
print(f"Hint: The python executable used by this script is located at \"{python_path}\"",file=sys.stderr)
# Run again with priviledges
subprocess.call(['sudo',python_path,*sys.argv])
sys.exit()
print(f"Default Config has been written to {config_path}")