2

My problem is somewhat similar to this question.

I have created a windows executable from a python program using PyInstaller with --onedir and --manifest options. Running the application does ask for administrator privilege. However it throws an IOError: [Errno 13] Permission denied for the following piece of code inside the application:

import os

_PATH = os.getenv('LOCALAPPDATA')
f = open(os.path.join(_PATH, 'Foo', 'Bar.txt'), 'w')
f.close()

Strangely enough the following piece of code outputs 1 as expected:

import ctypes
print ctypes.windll.shell32.IsUserAnAdmin()

I am using Python 2.7.10 amd64. In the linked question someone pointed out that Python 2.7.10 amd64 doesn't work with the Manifest file. I also tried the most upvoted answer in that question, editing the PyInstaller library, but that didn't help. Did anyone else face this?

Community
  • 1
  • 1
user2963623
  • 2,267
  • 1
  • 14
  • 25

0 Answers0