Module ‘os’ has no attribute ‘uname’ ( Solved )

Module 'os' has no attribute 'uname'

OS module is a python module that allows you to interact with the operating systems. It uses various functions to interact with the operating system. Using it you can automatically tell the python interpreter to know which operating system you are running the code. But while using this module function sometimes you get AttributeError.  The AttributeError: module ‘os’ has no attribute ‘uname’ is one of them.

In this entire tutorial, you will learn how to solve the issue of module ‘os’ has no attribute ‘uname’ easily.

The root cause of the module ‘os’ has no attribute ‘uname’ Error

The root cause of this attributeError is that you must be using the uname() function wrongly. The import part of the os module is right but the way of using the uname() is wrong.

If you will use os.uname() on your Windows OS then you will get the error.

import os


module os has no attribute uname
os has no attribute uname error

Solution of the module ‘os’ has no attribute ‘uname’

The solution of the module ‘os’ has no attribute ‘uname’ is very simple. You have to properly use the uname() method. If your operating system is Unix then its okay to use os.uname().

But in case you are using the Windows operating system then import platform instead of import os. In addition call platform.uname() instead of os.uname().

You will not get the error when you will run the below lines of code.

import platform


System Information using the function uname
System Information using the function uname


OS module is very useful if you want to know the system information. But there are some functions that lead to attributerror as that function may not support the current Operating system.

If you are getting the  ‘os’ has no attribute ‘uname’ error then the above method will solve your error.

I hope you have liked this tutorial. If you have any queries then you can contact us for help. You can also give suggestions on this tutorial.

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Sukesh ( Chief Editor ), a passionate and skilled Python programmer with a deep fascination for data science, NumPy, and Pandas. His journey in the world of coding began as a curious explorer and has evolved into a seasoned data enthusiast.
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner