Tag Archives: python

Thoughts on PySide

I have been experimenting with PySide within Maya 2014 for the past couple months and I have to say its been pretty easy to pick up after knowing some PyQt. It has virtually identical commands as PyQt and since it can load user interfaces from Qt Designer, there really isn’t a recent not to use it when coding in Python. I have to give credit to Nathan Horne though as without his guide I would have been thoroughly stuck on trying to figure out how to load the interface as it definitely is not as easy as it could be.

Jump down to where it says “How to load a designer file”
http://nathanhorne.com/?p=451

Some code snippets for common tasks

Get the username of the active account logged in:

import getpass
currentUser = getpass.getuser()
print currentUser
'chris'

Get information about the operating system:

import platform
print platform.system()
'Windows'

print platform.release()
'XP'

print platform.version()
'5.1.2600'

Create a folder with error checking:

import os
try:
	os.makedirs('c:/test')
except Exception as err:
	print err

Check if a file or folder exists:

import os
print os.path.exists("C:/test/")
'False'