+ 2
Can someone please explain why I am getting this attribute error? IS IT OPERATING SYSTEM DEPENDENT METHOD???
AttributeError:module 'os' has no attribute 'openpty' dir(os) shows no openpty attribute but when I searched on internet nothing related to it is give . CODE: import os getattr(os,'openpty') dir(os) Its not in the attributes list os.openpty also gives the same error
4 Answers
+ 1
openpty is probably an operating system dependent attribute
Because it is available in Linux but not in windows
I'm using windows it does not show this attribute in the output of dir(os)
but it shows the 'openpty' attribute in Linux
+ 7
please show us a code or screenshot. Thanks!
+ 7
openpty() is a method of os, you can use it like:
import os
master, slave = os.openpty()
Please show us your code next time. it's not easy to guess what you have done. Thanks!
+ 3
Attribute error show up when you try to call class attribute that does not exists!!!
mostly this happen because of typo