0

I am making an installer for py2exe packaged app. py2exe catches strerr and put that in log file created in the same folder as executable. So, installing the app into "Program Files" will cause a problem because the app does not have the right to create a file in there.

I do not want to edit the manifest to ask for UAC for the app either. So, I was thinking to configure my installer to use the user home directory as default installation folder.

But user home is meant for documents and photos and such.

(edit) I really want to keep it together with the executable, because i want users to easily locate the log file and send it to me for debugging.

So, is it a bad practice? Any better way around?

otterb
  • 2,660
  • 2
  • 29
  • 48

1 Answers1

1

py2exe catches strerr and put that in log file created in the same folder as executable

You can override py2exe's default behavior and place log file in specific folder. See py2exe error logging for details. I would suggest placing log files in AppData/Local folder.

What is the AppData folder?

The AppData folder contains app settings, files, and data specific to the apps on your PC. The folder is hidden by default in File Explorer, and has three hidden sub-folders: Local, LocalLow, and Roaming.

  • Roaming. This folder (%appdata%) contains data that can move with your user profile from PC to PC—like when you’re on a domain—because this data has the ability to sync with a server. For example, if you sign in to a different PC on a domain, your web browser favorites or bookmarks will be available.

  • Local. This folder (%localappdata%) contains data that can't move with your user profile. This data is typically specific to a PC or too large to sync with a server. For example, web browsers usually store their temporary files here.

  • LocalLow. This folder (%appdata%/…/locallow) contains data that can't move, but also has a lower level of access. For example, if you're running a web browser in a protected or safe mode, the app will only be able access data from the LocalLow folder.

Piotr Dobrogost
  • 41,292
  • 40
  • 236
  • 366
  • thanks for the suggestion. Yes, there seems to be a way to redirect it. basically `sys.strerr = open('path/log.txt','w')` will do it. But, I really want to keep it together with the executable, because i want the users to find it and send it to me for debugging. AppData/Local may be bit too hidden for average users. – otterb Oct 22 '14 at 21:34
  • @otterb In this case install application in the standard folder and place log file in user's home directory. User's home directory is for any data of interest to user not only *for documents and photos and such*. – Piotr Dobrogost Oct 22 '14 at 21:38
  • Yes, I considered that possibility too. I am wondering what is easiest for users to find the log file. In my experience, if people download and extract zip and then click on the exe file to launch, then they have no problem locating the log file in the same folder. So, i thought this may be a safer option. But now I am going to provide a nice installer that will create a start menu shortcut. Then maybe user's home may be better off? But how bad is it to install executable in user home? – otterb Oct 22 '14 at 21:47
  • @otterb: Bad. This *will* annoy people. – Harry Johnston Oct 22 '14 at 23:26