+ 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

7th Oct 2020, 7:48 PM
Hemant
Hemant - avatar
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
7th Oct 2020, 8:38 PM
Hemant
Hemant - avatar
+ 7
please show us a code or screenshot. Thanks!
7th Oct 2020, 7:54 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 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!
7th Oct 2020, 8:17 PM
Lothar
Lothar - avatar
+ 3
Attribute error show up when you try to call class attribute that does not exists!!! mostly this happen because of typo
7th Oct 2020, 8:10 PM
Shadoff
Shadoff - avatar