Import OS module example.

Hi there.
Here i explain a bit about the OS module functionality.
Basically it opens up the possibility for Maya to comunicate with
the OS. In this case we are going to create a simple folder called “Test_folder”

#first import the module
import os

#get the home directory through the environment variable 'HOME' and store in var dir
dir =os.getenv('HOME')

#join dir with "/Documents"

#create a Test_folder inside "/documents"

if you write dir(os) and execute, you can see all of its functionality printed on the console.

for instance ‘rmdir’ – removes a directory

write -> help(os.rmdir)
and you will see the help on each of them, in this case (rmdir) prints:

Remove a directory.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s