python - .exe closes immediately after launch when double clicked -


i've created exe file using py2exe module. weird thing works has work when run exe command line when double-click on exe, opens console (as has do) , console closes immediately.

i wrote logging method figure out problem , surrounded method try-except not catch exception.

here piece of code:

if __name__ == '__main__':     try:         mh = moto()         db = database() # can find __init__ of database() below         log('ok') # can't find line in log file problem inside __init__ od database()     except exception e:          log(str(e))         log(str(traceback.format_exc))      url in [__cats__,__hyphens__]:         log(' url') 

init database():

class database():      def __init__(self):             self.conn = sqlite3.connect('db.db') # database created             self.cursor = self.conn.cursor()             self.create_table_moto()             self.drop_and_create_temp_table()             log('init_end') # can find line in log file problem should after database() initialization doubt because of log right after database() 

so main weird thing __init__ method of database() working correctly because can see last line log('init_end') in log file. rigth after initialization log log('ok') don't see in log file , no exception has been catched.

very important edit:

when creating exe file using py2exe, creates folder dist in folder project stored. exe file can started using cmd when i'm in parent folder have write dist\moto.exe. moto.exe or project\dist\moto.exe not work. edit:

another weird thing:

i've added line: mlib.printtofile('testovaci_txt.txt', 'nieco') right after log('ok') not working , creates file testovaci_txt.txt in folder 'exe' , other files stored.

edit2: log method in external library inside site-packages. figure out log('ok') saves file i've created 'log_2('ok')' creates file logging-testing.txt , put right after log('ok') , starts program. searched file in windows , can't find it.

do know problem?

it's design.

if double-click exe runs , closes. may put "raw_input()" (for python2) or "input()" (for python3) @ end of file (after " log(' url') " indentation used " url in [__cats__,__hyphens__]: ").

about 'ok' in log, log() function created? if so, append '\n' every line of log before writing file?


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -