NEWB: dividing numbers
I just tried python first time. 2/3 the result is zero I want the result to be .333... How do I get this? Thanks a lot L -- http://mail.python.org/mailman/listinfo/python-list
cannot open shared object file
Hi, We are getting the following error during a 'make' process on a CentOS release 5.4 system: Running mkfontdir... Creating SELinux policy... /usr/bin/python: error while loading shared libraries: libpython2.4.so.1.0: cannot open shared object file: No such file or directory However, we are able to execute 'python' without any problem # which python /usr/bin/python # python Python 2.4.3 (#1, Sep 3 2009, 15:37:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> # ldd /usr/bin/python libpython2.4.so.1.0 => /usr/lib64/libpython2.4.so.1.0 (0x003fb760) libpthread.so.0 => /lib64/libpthread.so.0 (0x003b5960) libdl.so.2 => /lib64/libdl.so.2 (0x003b5920) libutil.so.1 => /lib64/libutil.so.1 (0x003b6400) libm.so.6 => /lib64/libm.so.6 (0x003b58e0) libc.so.6 => /lib64/libc.so.6 (0x003b58a0) /lib64/ld-linux-x86-64.so.2 (0x003b5860) # ls -lad /usr/lib64/*python* lrwxrwxrwx 1 root root 19 Feb 27 21:15 /usr/lib64/libpython2.4.so -> libpython2.4.so.1.0 -r-xr-xr-x 1 root root 1236344 Sep 3 2009 /usr/lib64/libpython2.4.so.1.0 drwxr-xr-x 18 root root 20480 Feb 27 21:15 /usr/lib64/python2.4 In this 'make' process, we are suppose to execute the applicate-specific python (/opt/rocks/bin/python) which has static link (not dynamic link) # ldd /opt/rocks/bin/python libpthread.so.0 => /lib64/libpthread.so.0 (0x003b5960) libdl.so.2 => /lib64/libdl.so.2 (0x003b5920) libutil.so.1 => /lib64/libutil.so.1 (0x003b6400) libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x003b6b40) libm.so.6 => /lib64/libm.so.6 (0x003b58e0) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x003b67c0) libc.so.6 => /lib64/libc.so.6 (0x003b58a0) /lib64/ld-linux-x86-64.so.2 (0x003b5860) Basically, we try to understand: * why /opt/rocks/bin/python not being used ? * why /usr/bin/python can not find the dynamic library Please let us know if you have any suggestion on how to troubleshoot this problem. If this is not the list to ask this type of question, please point us to the appropriate list. Thanks. S. -- http://mail.python.org/mailman/listinfo/python-list
Running files with the associated program...
Hello all, How can I start a file (on Windows) with the associated program, Like if I want to open a bmp file, I want to to be shown in the program that all bmp files are associated with. I need a python code to do this. Thanks, -- http://mail.python.org/mailman/listinfo/python-list
Re: Running files with the associated program...
On Feb 6, 6:09 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 05 Feb 2008 22:34:59 -0200, E-Lo <[EMAIL PROTECTED]> escribió: > > > How can I start a file (on Windows) with the associated program, > > http://docs.python.org/lib/os-process.html#l2h-2760 > > startfile(path[, operation]) > Start a file with its associated application. > When operation is not specified or 'open', this acts like double-clicking > the file in Windows Explorer, or giving the file name as an argument to > the start command from the interactive command shell: the file is opened > with whatever application (if any) its extension is associated. > > -- > Gabriel Genellina thanks, it worked :) -- http://mail.python.org/mailman/listinfo/python-list
which one is more efficient
I have type variable which may have been set to 'D' or 'E' Now, which one of following statements are more efficient if type =='D' or type == 'E': or if re.search("D|E", type): Please let me know because the function is going to called 10s of millions of times. Thanks Kilo -- http://mail.python.org/mailman/listinfo/python-list
Python for Palm OS
Is there any other edition of Python for Palm OS instead of Pippy? -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: how to update a panel content/layout according to a variable content
Thanks for the answer. I will try the method you talked about. For the moment, I am creating a new sizer and new panel and call the SetSizer(...) and SetAutoLayout(...) but this is not satisfying me. Loïc "F. GEIGER" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > wxWindow has Update and Refresh methods. You can override the one of your > wxPanel, where you can call all its children to update/refresh themselves. > wxPanel's update could be triggered by a timer event, mouse event or > whatever. > > I do such things preferably in timers owned by the widgets themselves. > > HTH > Franz GEIGER > -- http://mail.python.org/mailman/listinfo/python-list
Re: In C extension .pyd, sizeof INT64 = 4?
Allen schrieb: > My C extension works wrong, and debug it, found that sizeof (INT64) = > 4, not 8. > I compile on Windows XP platform. > Please tell me how to fix it to support INT64? What *is* INT64? It's not a builtin type of standard C, it isn't defined by Microsoft C, and it isn't predefined by Python. So it must be something that you have defined, and apparently incorrectly. How did you define it? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: how to refer to partial list, slice is too slow?
人言落日是天涯,望极天涯不见家 schrieb: > I'm a python newbie. It seems the slice operation will do copy. > for example: a = [1,2,3,4,5,6,7,8,9,0] b = a[7:] b > [8, 9, 0] a.remove(9) a > [1, 2, 3, 4, 5, 6, 7, 8, 0] b > [8, 9, 0] > > if the list have large members, the slice operations will consume many > times. > for instance, I have a long string named it as S, the size is more > than 100K > I want to parser it one part-to-part. first, I process the first 100 > byte, and pass the remainder to the next parser function. I pass the > S[100:] as an argument of the next parser function. but this operation > will cause a large bytes copy. Is there any way to just make a > reference to the remainder string not copy? You can use itertools.islice: py> a = [1,2,3,4,5,6,7,8,9,0] py> b = itertools.islice(a, 7) py> b py> b.next() 1 py> b.next() 2 py> b.next() 3 py> b.next() 4 py> b.next() 5 py> b.next() 6 py> b.next() 7 py> b.next() Traceback (most recent call last): File "", line 1, in ? StopIteration HTH, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: how to print the GREEK CAPITAL LETTER delta under utf-8 encoding
人言落日是天涯,望极天涯不见家 schrieb: > I lookup the utf-8 form of delta from the link. > http://www.fileformat.info/info/unicode/char/0394/index.htm > > and then I want to print it in the python ( I work under windows) > > #!/usr/bin/python > #coding=utf-8 > > print "\xce\x94" > > but the result is not the 'delta' but an unknown character. I assume you print to the terminal (cmd.exe). This cannot work; the terminal (usually) does not interpret the characters in UTF-8. Instead, you should print a Unicode string, e.g. print u"\N{GREEK CAPITAL LETTER DELTA}" or print u'\u0394' This should work as long as your terminal supports printing the letter at all. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: how to print the GREEK CAPITAL LETTER delta under utf-8 encoding
> yes, it could print to the terminal(cmd.exe), but when I write these > string to file. I got the follow error: > > File "E:\Tools\filegen\filegen.py", line 212, in write > self.file.write(data) > UnicodeEncodeError: 'ascii' codec can't encode character u'\u0394' in > position 0 > : ordinal not in range(128) Yes, when writing to a file, you need to define an encoding, e.g. self.file.write(data.encode("utf-8")) You can use codecs.open() instead of open(), so that you can just use self.file.write(data) Alternatively, you can find out what sys.stdout.encoding is, and use that when encoding data for the terminal (falling back to "utf-8" when .encoding is not available on the file). > but other text, in which include "chinese characters" got from > os.listdir(...), are written to the file OK. why? Your version of Windows uses a code page that supports Chinese characters in the byte-oriented character set. These are normally encoded using the "mbcs" encoding (except that the terminal likely uses a different encoding). So if you use "mbcs" instead of "utf-8", you might be able to read the text as well. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: How to print this character u'\u20ac' to DOS terminal
人言落日是天涯,望极天涯不见家 schrieb: > Who could explain the follow issue ? print u'\u0394' > Δ print u'\u20ac' > Traceback (most recent call last): > File "", line 1, in > UnicodeEncodeError: 'gbk' codec can't encode character u'\u20ac' in > position 0: > illegal multibyte sequence > > My terminal is cmd.exe under windows XP. > what's the different between the two character ? what can I do if I > want to print the u'\u20ac'? The problem is that your terminal uses (some form of) the GBK encoding; see http://zh.wikipedia.org/wiki/GBK for details on GBK. It seems that GBK (or, rather, code page 936) supports the delta character, but not the euro sign. To change that, you can use "chcp" in your terminal window. For example, if you do "chcp 850", you should be able to display the euro sign (but will simultaneously use the ability to display the letter delta, and the chinese letters). I don't know whether the terminal supports an UTF-8 code page; you can try setting the terminal's code page to 65001 (which should be UTF-8). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Linking debug C++ DLL with python dlls
> So I decided to download and build the debug version of python2.5.1/ > As it seems I also need to compile all relevant extension modules > (*.pyd) in debug as well - is this correct? That's correct. > I tried to change the code above (just for fun) so in both cases i'll > use python25.lib and in debug compilation I got linker errors on > unresolved externals. seems like the debug version exports more > methods than the release version. Correct. > Is there a way to have my C++ code compile in debug mode (with _DEBUG) > but use the python25 release lib/dll? This way I don't need to have > additional set of debug extension modules. Try removing the definition of Py_DEBUG that is implied by _DEBUG. Notice, however, that it is risky to mix different CRT versions (debug and nodebug) in a single application; this could cause memory leaks and crashes. In particular, it *will* cause crashes if you pass FILE* opened by the debug CRT to PyRun_File and friends. That's an inherent limitation of Windows DLLs, and the way Microsoft set up global variables in the VC CRT. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list
Re: Unicode File Names
> Step 4: Either wait for Python 2.7 or apply the patch to your own copy > of zipfile ... Actually, this is released in Python 2.6, see r62724. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list