def startserver(): if os.path.isfile(u'e:\\system\\libs\\fileserver.py'): server_script=u'e:\\system\\libs\\fileserver.py' elif os.path.isfile(u'c:\\system\\libs\\fileserver.py'): server_script=u'c:\\system\\libs\\fileserver.py' else: appuifw.note(u'fileserver.py not found','error') return addr=discover_address('fileserver_conf.txt') if addr: e32.start_server(server_script) appuifw.note(u'File server started','info')
def test_start_server(self): if e32.in_emulator(): print "Cannot test e32.start_server on emulator" return server_script = u"c:\\data\\python\\test\\e32_start_server.py" # Create a test script which writes to a file f = open(server_script, "w") f.write(server_test_code) f.close() # Start the server and wait for a maximum of 20 seconds for the server # to write to the tempfile e32.start_server(server_script) for i in range(10): e32.ao_sleep(2) if os.path.exists(server_tempfile): break tempfile_text = open(server_tempfile, "r").read() self.failUnless(tempfile_text == 'start_server works!') os.remove(server_script) os.remove(server_tempfile)
def __init__(self, database = None): # TODO make this not a dummy store :-) self.lock = e32.Ao_lock() # Save our database object self.database = database self.timer = e32.Ao_timer() self.timerRunning = False if dataPath[0] == 'C': pythonPath = u'C:\\System\\Apps\\Python\\my' elif dataPath[0] == 'E': pythonPath = u'E:\\System\\Apps\\Python\\my' # @TODO@ # Update this to eventually not start servers (consumes too many resources) log.write('starting server') e32.start_server(pythonPath + u'\\FluidNexusServer.py') log.write('starting client') e32.start_server(pythonPath + u'\\FluidNexusClient.py')
import e32 e32.start_server(u"Z:\\system\\apps\\python\\symbian_startdaemon.py")
def start(): """ Start pygame launcher """ pygame.display.init() pygame.font.init() while True: # Don't handle events given for launched application pygame.event.clear() a = Application() # The executable is received path_to_app = a.run() # Clear cyclic references and the launcher out of the way # Not needed in PyS60 1.9.x del a.bg.sysdata del a.bg del a._main_menu.sysdata del a._main_menu.bg del a._main_menu._items del a._main_menu del a.focused del a.sysdata a.sprites.empty() del a if path_to_app: path_to_app = os.path.abspath(path_to_app) if sys.platform == "symbian_s60": import e32 if e32.in_emulator(): # Run the application and restart launcher after app is completed. # e32.start_exe does not work on emulator at the time of writing this # See #3549 at garage. execfile(path_to_app, {'__builtins__': __builtins__, '__name__': '__main__', '__file__': path_to_app, 'pygame' : pygame } ) else: # The application is started in it's own process on device. # S60 SDL does not show the selected application correctly when using double buffering, # but it is needed to make application hide correctly on device. datapath = os.path.join( THISDIR, "startapp.txt" ) f = open(datapath,'w') f.write(path_to_app) f.close() # The launcher starts a new pygame.exe process for the selected application. # This process must close before starting the new one. p = os.path.abspath( join( THISDIR, "..", "pygame_main.py") ) e32.start_server( p ) else: # TODO: Use subprocess os.system("start pythonw " + join( THISDIR, "..", "pygame_main.py") + " " + path_to_app ) # Exit launcher break pygame.quit()