2012-02-15, 19:42
tria Wrote:You are correct. The problem was due to my text editor. I forgot to set it to auto check for update on the log file, so whenever an error happened I never saw it in the log (no auto update). Once I sorted that, I managed to fix the issues one by one and now have it running with subproccess. However, I had to remove one parameter which is "startupinfo". If I leave it as a parameter I get this error
Code:18:31:24 T:5008 INFO: -->Python script returned the following error<--
18:31:24 T:5008 ERROR: Error Type: <type 'exceptions.AttributeError'>
18:31:24 T:5008 ERROR: Error Contents: 'str' object has no attribute 'dwFlags'
18:31:24 T:5008 ERROR: Traceback (most recent call last):
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\addon.py", line 20, in <module>
plugin.Main()
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\resources\lib\launcher_plugin.py", line 179, in __init__
self._run_rom(launcher, rom)
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\resources\lib\launcher_plugin.py", line 1316, in _run_rom
proc = subprocess.Popen(r'%s %s' % (launcher["application"], arguments), shell=False, stdout=subprocess.PIPE, cwd=apppath, startupinfo=info)
File "C:\Program Files (x86)\XBMC\system\python\Lib\subprocess.py", line 623, in __init__
errread, errwrite)
File "C:\Program Files (x86)\XBMC\system\python\Lib\subprocess.py", line 798, in _execute_child
startupinfo.dwFlags |= _subprocess.STARTF_USESTDHANDLES
AttributeError: 'str' object has no attribute 'dwFlags'
18:31:24 T:5008 INFO: -->End of Python script error report<--
18:31:24 T:5008 INFO: Python script stopped
If you have any idea why (because I don't want to change your script default actions). Without it, the emulator run fine, and I get back output from STDOUT. But I want it to be with that parameter if it is important.
This was with "subproccess", if I used the hacked one "subprocess_hack" (whether it is with the parameter "startupinfo" or without it), then I get this error:
Code:18:42:26 T:6116 ERROR: Error Type: <type 'exceptions.TypeError'>
18:42:26 T:6116 ERROR: Error Contents: an integer is required
18:42:26 T:6116 ERROR: Traceback (most recent call last):
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\addon.py", line 20, in <module>
plugin.Main()
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\resources\lib\launcher_plugin.py", line 179, in __init__
self._run_rom(launcher, rom)
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\resources\lib\launcher_plugin.py", line 1316, in _run_rom
proc = subprocess_hack.Popen(r'%s %s' % (launcher["application"], arguments), shell=False, stdout=subprocess.PIPE, cwd=apppath)
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\resources\lib\subprocess_hack.py", line 537, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\resources\lib\subprocess_hack.py", line 595, in _get_handles
p2cread = self._make_inheritable(p2cread)
File "XXXX\AppData\Roaming\XBMC\addons\plugin.program.advanced.launcher\resources\lib\subprocess_hack.py", line 636, in _make_inheritable
DUPLICATE_SAME_ACCESS)
TypeError: an integer is required
18:42:26 T:6116 INFO: -->End of Python script error report<--
18:42:26 T:6116 INFO: Python script stopped
It would be better if I get a possible fix for the subprocess_hack version, as it will be closer to your implementation. Any ideas?
Oh, and I managed to get output from STDOUT as I wished, so expect some contribution in a couple of weeks (if not closer).
Thanks.
Startupinfo is used to control the windows state of the started application. Advanced Launcher need it and use it to show/hide the bash windows when a .bat executable is started. So it is important to keep it.
For the use with subprocess_hack function call must not be :
Quote:proc= subprocess_hack.Popen(r'%s %s' % (launcher["application"], arguments), shell=False, stdout=subprocess_hack.PIPE, cwd=apppath)