Re: bug in os.system?
OK, I give up. Why does workaround #2 work? Also, I didn't realize this before, but when you call os.spawnv, the argument list you pass starts with the name of the executable you're calling! When you call a program from cmd.exe, that program name is the first parameter automatically. But with spawnv, you do that manually! Anyway, thanks for your help! -- http://mail.python.org/mailman/listinfo/python-list
bug in os.system?
The following code fails (pythonbugtest.exe takes one parameter, a string): import os result = os.system('"pythonbugtest.exe" "test"') assert(result == 0) The error message is: 'pythonbugtest.exe" "test' is not recognized as an internal or external command, operable program or batch file. Traceback (most recent call last): File "C:\Nick\!My Programs\Python\bugtest\python1.py", line 8, in ? assert(result == 0) AssertionError If I remove the quote marks around "pythonbugtest.exe" or "test", it works fine. But sometimes I need those quote marks, if e.g. there are spaces in filenames. I think this is a bug? I'm running Python 2.4.1 on Windows XP Pro. -- http://mail.python.org/mailman/listinfo/python-list
deprecation of has_key?
I haven't heard of any plans to deprecate the dictionary has_key method, as the "in" keyword makes it obsolete. i.e. if key in dict: instead of if dict.has_key(): Is there some reason to keep has_key? --Nick -- http://mail.python.org/mailman/listinfo/python-list
number conversion
I'm writing a program to read in raw data from a WAV file, and write it to an IT file. I got this to work in C by reading the data into an array of unsigned chars called "RawDataAry", then converted it to signed chars by doing the following: signed char *CharAry = malloc(sizeof(signed char) * frames); for (i = 0; i < input_frames; i++) CharAry[i] = (signed char)(((signed short)WavDataAry[i]) - 128); It worked. But when I tried to do this kind of conversion in Python, I got an OverflowError exception. First I read the data into an array of unsigned chars: fmt = str(chunklen) + 'B' fmtsize = struct.calcsize(fmt) rawdata = struct.unpack(fmt, s[:fmtsize]) rawdata = list(rawdata) Then I tried to convert it: charary = array.array('b') charary.fromlist(rawdata) This last line threw the OverflowError exception, "OverflowError: signed char is greater than maximum." Is there a way to do this?? Thanks a lot in advance!! --Nick -- http://mail.python.org/mailman/listinfo/python-list