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

Screenshot() does not save any file in PyAutoGUI 0.9.54 #874

Open
jingcodeguy opened this issue Aug 17, 2024 · 1 comment
Open

Screenshot() does not save any file in PyAutoGUI 0.9.54 #874

jingcodeguy opened this issue Aug 17, 2024 · 1 comment

Comments

@jingcodeguy
Copy link

Version: PyAutoGUI 0.9.54

The screenshot function with the filename parameter does not save any file. I have tried using both relative and absolute paths, but the result is the same—no file is saved. There are no warnings or errors indicating a failure to save the screenshot.

However, when using the returned Pillow image object, the image can be saved successfully. The current workaround is to manually save the image using the returned object.

Here is a code example demonstrating the issue:

import os
import pyautogui

print(os.getcwd())
try:
    im1 = pyautogui.screenshot('test.png')  # Does not save anything
    im1.save('test-from-pil.png')  # Successfully saves the file
    print("Screenshot saved successfully!")
except Exception as e:
    print(f"Error: {e}")
@nick-youngblut
Copy link

nick-youngblut commented Aug 24, 2024

Same here. I'm fine with using im1.save(), but it would be helpful if the docs were updated accordingly.

My conda env:

# Name                    Version                   Build  Channel
bzip2                     1.0.8                h99b78c6_7    conda-forge
ca-certificates           2024.7.4             hf0a4a13_0    conda-forge
libexpat                  2.6.2                hebf3989_0    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libsqlite                 3.46.0               hfb93653_0    conda-forge
libzlib                   1.3.1                hfb2fe0b_1    conda-forge
mouseinfo                 0.1.3                    pypi_0    pypi
ncurses                   6.5                  hb89a1cb_0    conda-forge
openssl                   3.3.1                h8359307_3    conda-forge
pillow                    10.4.0                   pypi_0    pypi
pip                       24.2               pyhd8ed1ab_0    conda-forge
pyautogui                 0.9.54                   pypi_0    pypi
pygetwindow               0.0.9                    pypi_0    pypi
pymsgbox                  1.0.9                    pypi_0    pypi
pyobjc-core               10.3.1                   pypi_0    pypi
pyobjc-framework-cocoa    10.3.1                   pypi_0    pypi
pyobjc-framework-quartz   10.3.1                   pypi_0    pypi
pyperclip                 1.9.0                    pypi_0    pypi
pyrect                    0.2.0                    pypi_0    pypi
pyscreeze                 1.0.1                    pypi_0    pypi
python                    3.11.9          h932a869_0_cpython    conda-forge
pytweening                1.2.0                    pypi_0    pypi
readline                  8.2                  h92ec313_1    conda-forge
rubicon-objc              0.4.9                    pypi_0    pypi
setuptools                72.2.0             pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge

os: macOS 14.4.1

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

No branches or pull requests

2 participants