Python cannot open file in C: \ Windows \ System32 \ oobe \ Info \ backgrounds

Windows 7 x64, Python 2.7. Trying to make a script to automatically change the login background. I am using pygame, an SDL shell for python, but the code should be clear:

import pygame import os image = pygame.image.load(os.path.normpath("C:/Users/nivekuil/Desktop/backgroundDefault.jpg")) surface = pygame.Surface((1366,768)) surface.fill((255,255,255)) surface.blit(image, (0,0)) surface = pygame.image.save(surface, os.path.normpath("C:/Windows/System32/oobe/Info/backgrounds/backgroundDefault.jpg")) 

It returns an error:

 Traceback (most recent call last): File "C:/Users/nivekuil/Documents/background.py", line 8, in <module> surface = pygame.image.save(surface, os.path.normpath("C:/Windows/System32/oobe/Info/backgrounds/backgroundDefault.jpg")) error: SaveJPEG: could not open C:\Windows\System32\oobe\Info\backgrounds\backgroundDefault.jpg 

I don't think this is a problem with pygame, as it works fine if I save it somewhere like Desktop. I also run IDLE as an administrator, and I also run the program as a task in the task scheduler with the "Run with highest privileges" check.

+4
source share
1 answer

Found a solution! Since, in accordance with this , I replaced / System32 / c / Sysnative /, and everything was fine.

+4
source

Source: https://habr.com/ru/post/1442663/


All Articles