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

Embedded python doesn't recognize exit() #90007

Closed
thewh1teagle mannequin opened this issue Nov 19, 2021 · 2 comments
Closed

Embedded python doesn't recognize exit() #90007

thewh1teagle mannequin opened this issue Nov 19, 2021 · 2 comments
Labels
3.10 only security fixes OS-windows type-bug An unexpected behavior, bug, or error

Comments

@thewh1teagle
Copy link
Mannequin

thewh1teagle mannequin commented Nov 19, 2021

BPO 45849
Nosy @pfmoore, @tjguk, @zware, @zooba, @thewh1teagle

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 2021-11-19.23:24:04.196>
created_at = <Date 2021-11-19.22:50:55.529>
labels = ['type-bug', 'invalid', '3.10', 'OS-windows']
title = "Embedded python doesn't recognize exit()"
updated_at = <Date 2021-11-19.23:24:04.196>
user = 'https://github.com/thewh1teagle'

bugs.python.org fields:

activity = <Date 2021-11-19.23:24:04.196>
actor = 'steve.dower'
assignee = 'none'
closed = True
closed_date = <Date 2021-11-19.23:24:04.196>
closer = 'steve.dower'
components = ['Windows']
creation = <Date 2021-11-19.22:50:55.529>
creator = 'thewh1teagle'
dependencies = []
files = []
hgrepos = []
issue_num = 45849
keywords = []
message_count = 2.0
messages = ['406624', '406628']
nosy_count = 5.0
nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower', 'thewh1teagle']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue45849'
versions = ['Python 3.10']

@thewh1teagle
Copy link
Mannequin Author

thewh1teagle mannequin commented Nov 19, 2021

C:\Users\user\Downloads\python-3.10.0-embed-win32>python
Python 3.10.0 (tags/v3.10.0:b494f59, Oct  4 2021, 18:46:30) [MSC v.1929 32 bit (Intel)] on win32
>>> exit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'exit' is not defined
>>> exit()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'exit' is not defined
>>> import os;os._exit(0)

C:\Users\user\Downloads\python-3.10.0-embed-win32>

same error when running exit from file.

@thewh1teagle thewh1teagle mannequin added 3.10 only security fixes OS-windows type-bug An unexpected behavior, bug, or error labels Nov 19, 2021
@zooba
Copy link
Member

zooba commented Nov 19, 2021

This is expected. The top-level exit() command only exists when the site module is imported, which is not the default for embedded Python (you should specify all the import paths explicitly, since they're going to be in your app rather than found by searching the disk).

You probably want to use sys.exit() in your script.

@zooba zooba closed this as completed Nov 19, 2021
@zooba zooba added the invalid label Nov 19, 2021
@zooba zooba closed this as completed Nov 19, 2021
@zooba zooba added the invalid label Nov 19, 2021
@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
3.10 only security fixes OS-windows type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant