Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Error Running From IIS on Windows #349

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

JavaScriptDude
Copy link

@JavaScriptDude JavaScriptDude commented Jan 18, 2022

When running Pyppeteer under windows via IIS, it fails because the AppDirs scan happens regardless of whether the PYPPETEER_HOME environment variable is set or not:

from pyppeteer import launch triggers the following Exception:

  File "C:\apps\sdk\python\Python38\lib\site-packages\pyppeteer\__init__.py", line 27, in <module>
    __pyppeteer_home__ = os.environ.get('PYPPETEER_HOME', AppDirs('pyppeteer').user_data_dir)  # type: str
  File "C:\apps\sdk\python\Python38\lib\site-packages\appdirs.py", line 419, in user_data_dir
    return user_data_dir(self.appname, self.appauthor,
  File "C:\apps\sdk\python\Python38\lib\site-packages\appdirs.py", line 81, in user_data_dir
    path = os.path.normpath(_get_win_folder(const))
  File "C:\apps\sdk\python\Python38\lib\site-packages\appdirs.py", line 481, in _get_win_folder_with_pywin32
    dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0)
pywintypes.com_error: (-2147024891, 'Access is denied.', None, None)

Reason for failure: The System user used by IIS does not have a user_data_dir. This issue will likely occur for other system processes under windows.

When running Pyppeteer  under windows via IIS, it fails because the AppDirs scan happens regardless of whether the PYPPETEER_HOME environment variable is set or not:

`from pyppeteer import launch` triggers the following Exception:

  File "C:\apps\sdk\python\Python38\lib\site-packages\pyppeteer\__init__.py", line 27, in <module>
    __pyppeteer_home__ = os.environ.get('PYPPETEER_HOME', AppDirs('pyppeteer').user_data_dir)  # type: str
  File "C:\apps\sdk\python\Python38\lib\site-packages\appdirs.py", line 419, in user_data_dir
    return user_data_dir(self.appname, self.appauthor,
  File "C:\apps\sdk\python\Python38\lib\site-packages\appdirs.py", line 81, in user_data_dir
    path = os.path.normpath(_get_win_folder(const))
  File "C:\apps\sdk\python\Python38\lib\site-packages\appdirs.py", line 481, in _get_win_folder_with_pywin32
    dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0)
pywintypes.com_error: (-2147024891, 'Access is denied.', None, None)
~end_err~

Reason for failure: The System user used by IIS (IIS_IUSRS) does not have a user_data_dir.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant