Reputation: 298
I'm using Python 3.9.12 and I get error in the following line
os.exit()
the Error message is: AttributeError: module 'os' has no attribute 'exit'
Upvotes: 1
Views: 3620
Reputation: 298
As from comment, exit
is a built-in. So os.exit()
becomes exit()
Upvotes: 1
Reputation: 49
make sure variable os not been overwrited, like filename or varable name ...
Upvotes: 1
Reputation: 1072
os.exit()
is not and was not a method of the os
module.
You may confuse it with os._exit()
or sys.exit()
Upvotes: 3