View Full Version : Python missing built-in module msvcrt
analogue
2009-01-08, 00:52
I'm using the python 'subprocess' module (the POpen class in particular) in a script and it has a dependency on module msvcrt. However, this built-in module doesn't seem to be available in the python packaged with XBMC. Any details as to why the msvcrt module it is not bundled or how it can be added?
Braindead things I've already tried but haven't worked:
- Added %SystemRoot%\system32 to the script's PYTHONPATH
- Copied msvcrt.dll to a directory and added that directory to the script's PYTHONPATH (error message changes to 'initmsvcrt' method not found')
- Ditto for msvcrt2.dll
rwparris2
2009-01-08, 01:58
I believe it is the LIBRARY that is missing, not the dll
Not sure about the cause yet but hopefully we can get it fixed soon... no subprocess in xbmc is unacceptable imo.
Nuka1195
2009-01-08, 20:15
Popen() works fine here in windows XBMC.
rwparris2
2009-01-08, 20:24
Popen() works fine here in windows XBMC.
Oddly, it works on my personal computer but not the one I have at work.
They're using different builds though, I will try a few different ones out then post the results. Also my work computer is xp sp2 while home on is sp3, if that possibly has anything to do with it.
In the meantime analogue if you could report what rev and what builder compiled the xbmc you're using (jester, ikon, kricker, xbmc, yourself, or ???) and what version of windows you are using.
rwparris2
2009-01-09, 23:21
Just reinstalled xbmc here at work (tried both kricker & jester builds) and everything works fine. It was probably a one time compilation error.
analogue
2009-01-10, 01:53
I'll get back to you with all the details once I get my hands on a windows machine again (today or tomorrow). Thanks for looking into it!
analogue
2009-01-12, 00:06
Oddly, it works on my personal computer but not the one I have at work.
They're using different builds though, I will try a few different ones out then post the results. Also my work computer is xp sp2 while home on is sp3, if that possibly has anything to do with it.
In the meantime analogue if you could report what rev and what builder compiled the xbmc you're using (jester, ikon, kricker, xbmc, yourself, or ???) and what version of windows you are using.
Tested in Windows XP SP3 with yesterdays Jester build and it works fine. Seems like only the XBMC Atlantis 8.10 build is affected.
strikegun
2009-01-12, 00:57
well,great.
i got the same problem.
Did you compile jesters build on your own or is it for download somewhere?
rwparris2
2009-01-12, 04:42
well,great.
i got the same problem.
Did you compile jesters build on your own or is it for download somewhere?
There are three 'builders'; any build in this thread will do fine.
http://xbmc.org/forum/showthread.php?t=35452
analogue
2009-01-12, 09:25
Tested in Windows XP SP3 with yesterdays Jester build and it works fine. Seems like only the XBMC Atlantis 8.10 build is affected.
Well, spoke too soon. msvcrt problem solved but now a problem with Popen and stdin.
1) Popen(args, shell=False, bufsize=BUF_SIZE, stderr=PIPE, stdout=PIPE, close_fds=False) blows up because the default value of stdin is None and _make_inheritable in subprocess.py doesn't like that for some reason and complains about expecting an int.
2) Popen(args, shell=False, bufsize=BUF_SIZE, stderr=PIPE, stdout=PIPE, stdin=PIPE, close_fds=False) blows up because XBMC doesn't have a console associated with it (from which it apparently gets the fd to pass as the stdin PIPE) and can't pass it on to the child process (took some googling to chase that one down)
Basically, Popen seems to be broken in the SVN trunk windows builds.
Can anyone confirm?
2) Popen(args, shell=False, bufsize=BUF_SIZE, stderr=PIPE, stdout=PIPE, stdin=PIPE, close_fds=False) blows up because XBMC doesn't have a console associated with it (from which it apparently gets the fd to pass as the stdin PIPE) and can't pass it on to the child process (took some googling to chase that one down)
I'm having this same issue. I tried a bunch of newer builds (the newest being 17925 by ikon) all with no luck. The new hulu script (http://xbmc.org/forum/showpost.php?p=287255&postcount=648) uses this function to run gnash and determine the encrypted pid. Does anyone know of a fix or a similar python function that works in windows?
analogue
2009-02-23, 09:04
I hacked around it by using os.system('some cmd > somefile') and then reading the file for the output :-(
Thanks, that seems to work for now. Hopefully this gets fixed for us windows users.