Modificato il programma principale in modo da fare un chdir nella directory

Leonardo Robol [2009-06-20 16:05]
Modificato il programma principale in modo da fare un chdir nella directory
dove c'è l'eseguibile, di modo che riesca a trovare le librerie che gli servono
per avviarsi.
Filename
songbook-editor.py
diff --git a/songbook-editor.py b/songbook-editor.py
index da865ec..34f3299 100755
--- a/songbook-editor.py
+++ b/songbook-editor.py
@@ -1,8 +1,11 @@
 #!/usr/bin/env python

-import re,sys
+import re,sys, os
 sys.path.append("./libs")
 sys.path.append("./ui")
+# Questo e' solo un trucchetto per fare in modo che il programm
+# trovi le mie librerie anche se viene lanciato da strani posti :)
+os.chdir("".join(sys.argv[0].rsplit("songbook-editor.py",1)))
 from PyQt4 import QtGui, QtCore
 from interface import *
 from options import *
ViewGit