Changes to make running py2exe exe happy.

This commit is contained in:
Eratosthenes 2010-02-05 23:19:58 -05:00
parent 4df991517e
commit 8aa18b95d8
2 changed files with 2 additions and 18 deletions

13
pyfpdb/Configuration.py Normal file → Executable file
View File

@ -166,10 +166,6 @@ if LOCALE_ENCODING == "US-ASCII":
# needs LOCALE_ENCODING (above), imported for sqlite setup in Config class below # needs LOCALE_ENCODING (above), imported for sqlite setup in Config class below
FROZEN = hasattr(sys, "frozen")
EXEC_PATH = get_exec_path()
import Charset import Charset
@ -617,8 +613,7 @@ class Config:
def save(self, file = None): def save(self, file = None):
if file is None: if file is None:
file = self.file file = self.file
shutil.move(file, file+".backup", ignore_errors = True) shutil.move(file, file+".backup")
with open(file, 'w') as f: with open(file, 'w') as f:
self.doc.writexml(f) self.doc.writexml(f)
@ -1035,9 +1030,3 @@ if __name__== "__main__":
PrettyPrint(site_node, stream=sys.stdout, encoding="utf-8") PrettyPrint(site_node, stream=sys.stdout, encoding="utf-8")
except: except:
print "xml.dom.ext needs PyXML to be installed!" print "xml.dom.ext needs PyXML to be installed!"
print "FROZEN =", FROZEN
print "EXEC_PATH =", EXEC_PATH
print "press enter to end"
sys.stdin.readline()

7
pyfpdb/GuiAutoImport.py Normal file → Executable file
View File

@ -193,11 +193,7 @@ class GuiAutoImport (threading.Thread):
self.doAutoImportBool = True self.doAutoImportBool = True
widget.set_label(u' _Stop Autoimport ') widget.set_label(u' _Stop Autoimport ')
if self.pipe_to_hud is None: if self.pipe_to_hud is None:
if Configuration.FROZEN: if os.name == 'nt':
path = Configuration.EXEC_PATH
command = "HUD_main.exe"
bs = 0
elif os.name == 'nt':
path = sys.path[0].replace('\\','\\\\') path = sys.path[0].replace('\\','\\\\')
command = 'python "'+path+'\\HUD_main.py" ' + self.settings['cl_options'] command = 'python "'+path+'\\HUD_main.py" ' + self.settings['cl_options']
bs = 0 bs = 0
@ -207,7 +203,6 @@ class GuiAutoImport (threading.Thread):
bs = 1 bs = 1
try: try:
print "opening pipe to HUD"
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
universal_newlines=True) universal_newlines=True)