question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxError: 'return' with argument inside generator, when import pyautogui

See original GitHub issue

These modules are installed in my virtual environment:

Successfully installed Pillow-5.4.1 PyTweening-1.0.3 boto3-1.9.110 botocore-1.12.114 certifi-2019.3.9 chardet-3.0.4 comtypes-1.1.7 docutils-0.14 futures-3.2.0 idna-2.8 jmespath-0.9.4 numpy-1.16.2 pyautogui-0.9.41 pycryptodome-3.7.3 pygetwindow-0.0.4 pymsgbox-1.0.6 pyodbc-4.0.26 pypiwin32-223 pyrect-0.1.4 pyscreeze-0.1.20 python-dateutil-2.8.0 pythonnet-2.3.0 pywin32-224 pywinauto-0.6.6 requests-2.21.0 s3transfer-0.2.0 six-1.12.0 slacker-0.12.0 urllib3-1.24.1 wmi-1.4.9 xlrd-1.2.0

Then, when I try to import pyautogui i got:

>>> import pyautogui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Adrian\Documents\GitHub\eagle-gold\scripts\python\env\lib\site-packages\pyautogui\__init__.py", line 84, in <module>
    import pyscreeze
  File "C:\Users\Adrian\Documents\GitHub\eagle-gold\scripts\python\env\lib\site-packages\pyscreeze\__init__.py", line 168
    yield Box(x, y, needleWidth, needleHeight)
SyntaxError: 'return' with argument inside generator

Any recent changes introduce it?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
adigrabcadcommented, Mar 18, 2019

Yes, sorry to do not mentioned that I’m using Python 2. Now I’m using pyautogui-0.9.41 and pyscreeze-0.1.19 and seems to work. Lesson learned: do not rely on the latest version since is not always better then previous one 😄

2reactions
KolbyFlippercommented, Mar 15, 2019

pip uninstall pyautogui pyscreeze pip install pyautogui==0.9.38 pyscreeze==0.1.18

I have the same problem, this didn’t solve it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python SyntaxError: ("'return' with argument inside generator",)
is a generator. But I would return the value variable to the handler that called the function. It's this possible? How can I...
Read more >
Issue 33555: No SyntaxError raised for `return` with argument ...
File "<stdin>", line 3 SyntaxError: 'return' with argument inside generator However, in python 3.6 the error is silently ignored Python ...
Read more >
a return to yield - Python Does What?!?
SyntaxError : 'return' with argument inside generator. A rare compile-time error! Only the decorative, bare return is allowed in generators, ...
Read more >
Cheat Sheet - PyAutoGUI documentation - Read the Docs
This is a quickstart reference to using PyAutoGUI. PyAutoGUI is cross-platform GUI automation module that works on Python 2 & 3. You can...
Read more >
Python: SyntaxError 'return' outside function error
Your docstring is indented further than the if conditional. docstrings are Python objects and as such are part of the code. Make sure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found