Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. def folder(self):
  2. home = os.sep.join((os.path.expanduser('~'),'Pulpit'))
  3. if not os.path.exists(home):
  4. home = os.path.join((os.path.expanduser('~'), 'Desktop'))
  5. opto = home + 'OptoMaQ'
  6. self.directory = opto
  7. nam = str(self.nmget.get())
  8. mypath = opto + '%s' %nam
  9. if not os.path.exists(opto):
  10. os.makedirs(opto)
  11. if len(nam) == 0:
  12. self.fold.config(text = 'This name is incorrect',background = 'red')
  13. else:
  14. if not os.path.exists(mypath):
  15. os.makedirs(mypath)
  16. self.fold.config(text = 'Folder was created',background = 'green')
  17. else:
  18. self.fold.config(text = 'This name is taken',background = 'red')
  19. else:
  20. if len(nam) == 0:
  21. self.fold.config(text = 'This name is incorrect',background = 'red')
  22. else:
  23. if not os.path.exists(mypath):
  24. os.makedirs(mypath)
  25. self.fold.config(text = 'Folder was created',background = 'green')
  26. else:
  27. self.fold.config(text = 'This name is taken',background = 'red')
  28.  
  29. if not os.path.exists(home):
  30. home = os.path.join(os.path.expanduser('~'), 'Desktop')
  31. opto = home + r'OptoMaQ'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement