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

for-loop doesn't work with -c #50302

Closed
exe mannequin opened this issue May 18, 2009 · 2 comments
Closed

for-loop doesn't work with -c #50302

exe mannequin opened this issue May 18, 2009 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@exe
Copy link
Mannequin

exe mannequin commented May 18, 2009

BPO 6052
Nosy @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-05-18.16:40:41.762>
created_at = <Date 2009-05-18.10:28:59.186>
labels = ['interpreter-core', 'invalid']
title = "for-loop doesn't work with -c"
updated_at = <Date 2009-05-18.16:40:41.759>
user = 'https://bugs.python.org/exe'

bugs.python.org fields:

activity = <Date 2009-05-18.16:40:41.759>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2009-05-18.16:40:41.762>
closer = 'r.david.murray'
components = ['Interpreter Core']
creation = <Date 2009-05-18.10:28:59.186>
creator = 'exe'
dependencies = []
files = []
hgrepos = []
issue_num = 6052
keywords = []
message_count = 2.0
messages = ['88024', '88035']
nosy_count = 2.0
nosy_names = ['exe', 'r.david.murray']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue6052'
versions = ['Python 2.6', 'Python 2.5', 'Python 3.0', 'Python 3.1', 'Python 2.7', 'Python 3.2']

@exe
Copy link
Mannequin Author

exe mannequin commented May 18, 2009

Hello!

I found this problem:

$ python3 -c 'import sys; for line in sys.stdout: pass'
  File "<string>", line 1
    import sys; for line in sys.stdout: pass
                  ^
SyntaxError: invalid syntax

Without import-statement this work great. Also code 'import sys; pass'
works too.

@exe exe mannequin added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label May 18, 2009
@bitdancer
Copy link
Member

The error message is correct: your example is invalid python code. Try
it in a file and you will get the same error message. Check the
documentation of the '-c' option to learn how to correctly code your
example.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)
Projects
None yet
Development

No branches or pull requests

1 participant