Advertisement
clockworkpc

Clockwork PC Python Script Generator

Apr 6th, 2011
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import os
  4. filename=raw_input("What do you want to call your Python file? ")
  5.  
  6. folder = os.getenv("HOME")+"/"+"Documents/bin/"
  7. pythonfile = folder + filename + ".py"
  8.  
  9. print folder
  10. print pythonfile
  11.  
  12. os.system('echo "#!/usr/bin/python" | tee ' + pythonfile)
  13.  
  14. f = open(pythonfile, "a")
  15.  
  16. f.write("#"+pythonfile+"""
  17.  
  18. # Released under a GPLv3 Licence by Clockwork PC 2011
  19. # www.clockworkpc.com.au
  20.  
  21. # You are entitled to the following four freedoms:
  22. # Freedom 0: To run this program for any purpose
  23. # Freedom 1: To study how this program works and change it to make it do what you wish
  24. # Freedom 2: To redistribute copies so you can help your neighbour
  25. # Freedom 3: To distribute copies of your modified version to others
  26. """)
  27. f.close()
  28.  
  29. os.system("chmod -v +x " + pythonfile)
  30. os.system("sudo ln -sv " + pythonfile + " /" + "usr/local/bin/" + filename + ".py")
  31. os.system("gedit " + pythonfile)
  32. os.system("xcowsay 'Your Python script is ready!'")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement