Tag Archives: python

django

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

Developed by a fast-moving online-news operation, Django was designed to handle two challenges: the intensive deadlines of a newsroom and the stringent requirements of the experienced Web developers who wrote it. It lets you build high-performing, elegant Web applications quickly.

python for sysadmins hints

os.system() # Executing a shell command

os.stat() # Get the status of a file

os.environ() # Get the users environment

os.chdir() # Move focus to a different directory

os.getcwd() # Returns the current working directory

os.getgid() # Return the real group id of the current process

os.getuid() # Return the current process’s user id

os.getpid() # Returns the real process ID of the current process

os.getlogin() # Return the name of the user logged

os.access() # Check read permissions

os.chmod() # Change the mode of path to the numeric mode

os.chown() # Change the owner and group id

os.umask(mask) # Set the current numeric umask

os.getsize() # Get the size of a file

os.environ() # Get the users environment

os.uname() # Return information about the current operating system

os.chroot(path) # Change the root directory of the current process to path

os.listdir(path)# List of the entries in the directory given by path

os.getloadavg() # Show queue averaged over the last 1, 5, and 15 minutes

os.path.exists()# Check if a path exists

os.walk() # Print out all directories, sub-directories and files

os.mkdir(path) # Create a directory named path with numeric mode mode

os.remove(path) # Remove (delete) the file path

os.rmdir(path) # Remove (delete) the directory path

os.makedirs(path)# Recursive directory creation function

os.removedirs(path) # Remove directories recursively

os.rename(src, dst) # Rename the file or directory src to dst

Error: ansible requires a json module, none found

How to fix?

yum install python-simplejson

but not python-json

if you will install python-json you still get errors like:

“msg”: “Traceback (most recent call last):\n  File \”/root/.ansible/tmp/ansible-1381145464.17-139681524282507/command\”, line 1137, in ?\n    main()\n  File \”/root/.ansible/tmp/ansible-1381145464.17-139681524282507/command\”, line 155, in main\n    changed = True\n  File \”/root/.ansible/tmp/ansible-1381145464.17-139681524282507/command\”, line 911, in exit_json\n    print self.jsonify(kwargs)\n  File \”/root/.ansible/tmp/ansible-1381145464.17-139681524282507/command\”, line 901, in jsonify\n    return json.dumps(data)\nAttributeError: ‘module’ object has no attribute ‘dumps’\n”,