parallel computations: subprocess.Popen(...).communicate()[0] does not work with multiprocessing.Pool

2011-06-10 Thread Hseu-Ming Chen
Hi, I am having an issue when making a shell call from within a multiprocessing.Process(). Here is the story: i tried to parallelize the computations in 800-ish Matlab scripts and then save the results to MySQL. The non-parallel/serial version has been running fine for about 2 years. However,

Re: Python 2.7 Debian 6.0. Squeeze

2011-05-12 Thread Chen Wei
$ apt-get update $ apt-get install python2.7 $ python --version Python 2.6.6 $ python2.7 --version Python 2.7.1+ -- Chen Wei -- http://mail.python.org/mailman/listinfo/python-list

Callbacks on program exiting/aborting

2011-03-03 Thread Pengcheng Chen
Dear folks, What callback mechanisms can we use in Python? We have some device drivers are in Python and sometimes they crash. I'd like to do some cleanup before program abort/crash. Any suggestions? Thanks so much! Pengcheng -- http://mail.python.org/mailman/listinfo/python-list

[issue7978] SocketServer doesn't handle syscall interruption

2010-10-26 Thread Kevin Chen
Changes by Kevin Chen kc...@mit.edu: -- nosy: +kchen ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7978 ___ ___ Python-bugs-list mailing list

Re: Why Python forbids multiple instances of one module?

2010-07-07 Thread CHEN Guang
Why Python forbids multiple instances of one module? If only Python allows multiple instances of one module, module will be enough to replace class in most cases. After all, it is much easier to write a module than a class, at least we do not have to write self everywhere. If you really

Why Python forbids multiple instances of one module?

2010-07-04 Thread CHEN Guang
Why Python forbids multiple instances of one module? If only Python allows multiple instances of one module, module will be enough to replace class in most cases. After all, it is much easier to write a module than a class, at least we do not have to write self everywhere. --

[python] how to ensure item in list or dict bind with an uuid meaning integer type ID?

2010-06-28 Thread kee chen
Dear all, I have 2 lists stored in 2 text files may have duplicated records, the raw data looks like this: lfruit lcountry == = orange japan pearchina

Re: How to send a non-standard IMAP command?

2010-06-25 Thread Xianwen Chen
On Jun 24, 2:23 pm, Michael Torrie torr...@gmail.com wrote: On 06/24/2010 03:47 AM, Xianwen Chen wrote: , but I got error messages. Any hint please? Why not just use a proxy server: http://sourceforge.net/projects/imapidproxy/ Hi Michael Thanks a lot! Yes, it would be much more

Re: How to send a non-standard IMAP command?

2010-06-25 Thread Xianwen Chen
On Jun 24, 2:25 pm, Tim Chase python.l...@tim.thechases.com wrote: On 06/24/2010 04:47 AM, Xianwen Chen wrote: Thanks a lot for your reply! I thought it would be simpler if the problem was presented in a brief way. Unfortunately, not for this case. Here is the detail. Free Yahoo! mail

Re: How to send a non-standard IMAP command?

2010-06-24 Thread Xianwen Chen
On 6/24/10, Tim Chase python.l...@tim.thechases.com wrote: On 06/23/2010 05:22 PM, Xianwen Chen wrote: I need to send one line of commands to an IMAP server. The commands are not standard IMAP protocols, hence it's not specified in http://docs.python.org/library/imaplib.html. Sounds like you

Re: How to send a non-standard IMAP command?

2010-06-24 Thread Xianwen Chen
On Thu, Jun 24, 2010 at 2:25 PM, Tim Chase python.l...@tim.thechases.comwrote: On 06/24/2010 04:47 AM, Xianwen Chen wrote: Thanks a lot for your reply! I thought it would be simpler if the problem was presented in a brief way. Unfortunately, not for this case. Here is the detail. Free

Parsing email

2010-06-23 Thread Xianwen Chen
Hi guys, I use these codes to read emails from an IMAP server: import imaplib imap_srv_addr = someserver imap_srv = imaplib.IMAP4_SSL(imap_srv_addr) imap_srv.login(username,passwd) imap_srv.select(Inbox) msg = imap_srv.fetch(1, '(RFC822)') How can I parse msg so it can be appended to the other

How to send a non-standard IMAP command?

2010-06-23 Thread Xianwen Chen
Dear Pythoners, I need to send one line of commands to an IMAP server. The commands are not standard IMAP protocols, hence it's not specified in http://docs.python.org/library/imaplib.html. Can you please give me a hint? Best regards, Xianwen --

How to add callbacks that is the same function with different argument in Tkinter python26?

2010-05-12 Thread chen zeguang
code is in the end. I want to print different number when pressing different button. Yet the program outputs 8 no matter which button is pressed. I guess it's because the callback function is not established untill the button is pressed, and i has already reached to 8. then How to add callbacks

Re: help req debugging python and c together

2010-04-19 Thread CHEN Guang
Hi, I am working in gnuradio compiler. I need some help in debugging python and c together. By this i mean that i have written some blocks in c that are connected together using python. So i need to debug ( breakpoints ect ) python such that when a specific c block is called at the back end

copy some files from IE temporary internet files

2010-04-19 Thread CHEN Guang
Hi friends, I want to program Python to copy some video files (.flv) from the IE folder temporary internet files, but os.listdir('C:\\Documents and Settings\\Administrator\\Local Settings\\Temporary Internet Files') seemed unable to find any video file (although they really exist and can

Re: getting a string as the return value from a system command

2010-04-17 Thread CHEN Guang
Catherine Moroney wrote: Hello, I want to call a system command (such as uname) that returns a string, and then store that output in a string variable in my python program. What is the recommended/most-concise way of doing this? I could always create a temporary file, call the

Re: finding objects in a piece of functional code ?

2010-04-11 Thread CHEN Guang
PythoidC (http://pythoidc.googlecode.com or http://pythoidc.sf.net ) took the similar technique finding objects in a piece of functional C code with Python In the thread Re: braceless and semicolonless, I discussed some details. May be of some help. - Original Message - From: Stef

Re: braceless and semicolonless

2010-04-10 Thread CHEN Guang
, Shenyang, northeast China. Will you tell me something about youself? Best Regards, ChenGuang 2010-04-09 22:24:27,Peter West peterjwe...@googlemail.com : Hi Chen, My project uses a tree structured linked list to break down PHP into chunks, It was necessary because PHP has a lot of syntaxes

Re: SIP

2010-04-09 Thread CHEN Guang
PythoidC ( http://pythoidc.sf.net ) provides some examples and templates for writing and importing C modules (.c or .exe) into Python environment, may be of some help. - Original Message - From: omnia neo neo.omn...@gmail.com To: python-list@python.org Sent: Friday, April 09, 2010 1:51

Re: Loading an imported module (C API)

2010-04-08 Thread CHEN Guang
to tackel the boring braces {} and line-end semicolons ; PythoidC automatically parses C header files, make corresponding Python objects, thus Python programmer can essily introspect into C ... ... CHEN Guang - Original Message - From: booncw chiaw...@gmail.com To: python-list@python.org Sent

[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-03-20 Thread Jelly Chen
Jelly Chen sinoje...@gmail.com added the comment: I know why those two tests run failed, and I found another way to solve the problem, do not make the existing tests broken, and at the same time I have added another test case. I encountered this problem due to a argument is already being a tuple

Re:Re: C++ code generation

2010-03-19 Thread CHEN Guang
Plug? Any evidence to say that? As long as this thread concerned, is there any answer more closed to the topic C++ code generation than mine? I think Stefan was telling you, in a nice way, to stop spamming every thread about code generation with a plug for your project. 2010/3/17 CHEN Guang

Re: C++ code generation

2010-03-18 Thread CHEN Guang
- Original Message - From: Dan Goodmandg.gm...@thesamovar.net I'm doing some C++ code generation using Python, and would be interested in any comments on the approach I'm taking. PythoidC ( http://pythoidc.googlecode.com ) is a C code generator (not C++) It would be nice if you

Re: Python bindings tutorial

2010-03-16 Thread CHEN Guang
Is there any tutorial how to write a bindings for a exe ( dos) program? I would like to run it from a Python directly ( using import command and a particular function from the binding) not using os.system command. An example: PythoidC ( http://pythoidc.googlecode.com ), look at

Re: C++ code generation

2010-03-16 Thread CHEN Guang
PythoidC ( http://pythoidc.googlecode.com ) is a C code generator (not C++) - Original Message - From: Dan Goodman dg.gm...@thesamovar.net To: python-list@python.org Sent: Wednesday, March 17, 2010 9:00 AM Subject: C++ code generation Hi all, I'm doing some C++ code generation

RE: python to exe

2010-03-13 Thread CHEN Guang
Does anyone know of a good python to stand alone exe compiler? Thanks, -Robin I tried several such tools and found the easiest one: Pyinstaller ( http://www.pyinstaller.org/ ) but it does not make your script faster, if you want it as fast as C language, please try PythoidC (

Re: file seek is slow

2010-03-12 Thread CHEN Guang
too far beyond C's preprocessor, believe it, or show us. CHEN Guang Convenient C Python mixed programming --- PythoidC ( http://pythoidc.googlecode.com ) -- http://mail.python.org/mailman/listinfo/python-list

Re: file seek is slow

2010-03-11 Thread CHEN Guang
) generates the shortest 'C' file. PythoidC is the C language like the Python, by the Python and for the Python. CHEN Guang-- http://mail.python.org/mailman/listinfo/python-list

RE: How to detect C Function block using python

2010-03-09 Thread CHEN Guang
In the source code of PythoidC ( http://pythoidc.googlecode.com ), I wrote a Parser for C header files with Python regular expression, not only functions but also structs macros. May be of some help. Hey All, I'm new in this community. I am writing a static analyzer for validating C Code

Re: Six Minutes and fourty two seconds

2010-03-09 Thread CHEN Guang
Tobiah wrote: Now that I use python, this is the amount of time per day that I spend adding forgotten semicolons while debugging other languages. What compels you to write Python code without semicolons? Frederic Try the C language without semicolons and braces

Re: The C language like the Python, by the Python and for the Python--- PythoidC

2010-03-08 Thread CHEN Guang
( ChenGuang ) ? CHEN Guang, 08.03.2010 06:08: Hi, if you are interested in C-Python mixed programming, please take a look at: http://pythoidc.googlecode.com PythoidC is the C language like the Python, by the Python and for the Python It looks a bit dangerous to me to parse C header files only

The C language like the Python, by the Python and for the Python --- PythoidC

2010-03-07 Thread CHEN Guang
Hi, if you are interested in C-Python mixed programming, please take a look at: http://pythoidc.googlecode.com PythoidC is the C language like the Python, by the Python and for the Python import c c.include(c.h.stdio) c.include(c.h.stdlib) '''Annotation is free!''' int fib(int n):

[issue5802] The security descriptors of python binaries in Windows are not strict enough

2010-03-02 Thread Hong Chen
Hong Chen cn.hongc...@gmail.com added the comment: Sure. Thank you for the information! Hong On Tue, Mar 2, 2010 at 4:26 AM, R. David Murray rep...@bugs.python.org wrote: R. David Murray rdmur...@bitdance.com added the comment: See also issue 1284316, which is still open, and should

[issue5802] The security descriptors of python binaries in Windows are not strict enough

2010-02-28 Thread Hong Chen
Hong Chen cn.hongc...@gmail.com added the comment: Sorry for the delay, it's been a busy month. I just tried python 3.1 If installed under c:\program files, the access control list would be correct, only system administrator accounts get the modify privilege. The default installation is to c

[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-22 Thread Jelly Chen
Jelly Chen sinoje...@gmail.com added the comment: I can't modify the issue. so i replay this email. The old xmlrpc lib don't use param surround a param. please take a look at wrong.xml and right.xml. 2010/2/22 Mark Dickinson rep...@bugs.python.org Mark Dickinson dicki...@gmail.com added

[issue7977] I found Python 3.1 xmlrpc lib use param not properly. and i have fixed it.

2010-02-22 Thread Jelly Chen
Jelly Chen sinoje...@gmail.com added the comment: Can i have a look at the failure tests? I just check out code at http://svn.python.org/projects/python/branches/py3k It's very slow. and i'm afraid that i don't know how to run the tests. The param tag use improperly is very clear. the wrong

[issue7986] Python 3 cannot recognize url like: https://sinojellycn:123...@storage.msn.com

2010-02-22 Thread Jelly Chen
New submission from Jelly Chen sinoje...@gmail.com: posturl='https://sinojellycn:123...@storage.msn.com/storageservice/MetaWeblog.rpc' username=sinojellycn password=123456 blog = pyblog.WordPress(posturl, username, password) content = {description:'Test description6', title:'Test article6

[issue7987] Python 3.1's http.client doesn't support HTTPS

2010-02-22 Thread Jelly Chen
New submission from Jelly Chen sinoje...@gmail.com: posturl='https://storage.msn.com/storageservice/MetaWeblog.rpc' username=sinojellycn password=123456 blog = pyblog.WordPress(posturl, username, password) content = {description:'Test description6', title:'Test article6'} blog.new_post(content

Can I embedding a (python) console on python program?

2010-02-19 Thread Kee K Y CHEN
the GEdit extension - python console and but may interactive with tty/vty lines. Can anyone give a brief to me? Thanks in advance. -- Kee K Y CHEN keekyc...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list

[issue5802] The security descriptors of python binaries in Windows are not strict enough

2010-02-07 Thread Hong Chen
Hong Chen cn.hongc...@gmail.com added the comment: Thanks for the reply. I can log in as a non-admin user and replace python.exe with another binary. Does that serve as an attack example? Hong On Sun, Feb 7, 2010 at 7:14 PM, Brian Curtin rep...@bugs.python.org wrote: Changes by Brian

[issue7597] curses.use_env implementation error

2009-12-30 Thread Kan-Ru Chen
New submission from Kan-Ru Chen ka...@kanru.info: According to doc: http://docs.python.org/library/curses.html#curses.use_env curses.use_env() must be called before initscr(), curses man page also says so. But python gives error: _curses.error: must call initscr() first test.py is the test

[issue7597] curses.use_env implementation error

2009-12-30 Thread Kan-Ru Chen
Changes by Kan-Ru Chen ka...@kanru.info: Added file: http://bugs.python.org/file15699/test_ctypes.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7597

[issue7597] curses.use_env implementation error

2009-12-30 Thread Kan-Ru Chen
Changes by Kan-Ru Chen ka...@kanru.info: -- keywords: +patch Added file: http://bugs.python.org/file15700/_curses.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7597

[issue7089] shlex behaves unexpected if newlines are not whitespace

2009-12-30 Thread Kan-Ru Chen
Changes by Kan-Ru Chen ka...@kanru.info: -- nosy: +kanru ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7089 ___ ___ Python-bugs-list mailing list

how to return value from button clicked by python

2009-09-11 Thread chen tao
Hi, I have several buttons, I want to realize: when I click first button, the button will call a function, and the function should return some parameter value, because I need this value for the other buttons. I tried the button.invoke() function, it almost got it...however, I only want it

[wxGlade] - How to add new event to a button in events tab

2009-09-08 Thread kaiqi chen
Hi, I am a newbie of wxGlade (0.6.2). I am trying buiding a simple application which is a frame contains a button. In the button properties window, select the events tab, there is a default event EVT_BUTTON, I have added a handler to this event, when I want to add a new event to the button here,

[wxGlade] - How to add new event to a button in events tab

2009-09-08 Thread kaiqi chen
Hi, I am a starter of wxGlade (0.6.2). I am trying buiding a simple application which is a frame contains a button. In the button properties window, select the events tab, there is a default event EVT_BUTTON, I have added a handler to this event, when I want to add a new event to the button here,

wxGlade question - How to add new event to a button in events tab?

2009-09-08 Thread kaiqi chen
Hi, I am a starter of wxGlade (0.6.2). I am trying buiding a simple application which is a frame contains a button. In the button properties window, select the events tab, there is a default event EVT_BUTTON, I have added a handler to this event, when I want to add a new event to the button here,

[issue6472] Inconsistent use of iterator in ElementTree doc diff between Py and C modules

2009-07-12 Thread Jerry Chen
Changes by Jerry Chen je...@3rdengine.com: -- nosy: +effbot ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6472 ___ ___ Python-bugs-list mailing

[issue5683] Speed up cPickle's pickling generally

2009-07-07 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Applied collinwinter's patch and svn up'd to r73872; replaced additional instances of self-write_func with _Pickler_Write. Passed test_xpickle.py as referenced by issue 5665. -- nosy: +jcsalterego Added file: http://bugs.python.org

[issue6415] warnings.warn segfaults on bad formatted string

2009-07-04 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Bug and patch confirmed on both py3k and python2.7 branches Before: $ ./python.exe warnsegfault.py this exception is caught: incomplete format this exception is also caught: incomplete format Bus error After: $ ./python.exe warnsegfault.py

[issue6364] freeze tool broken in Python 3.x

2009-06-29 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: I am unable to reproduce with py3k latest r73676 after making and installing, and running $ python3.2 freeze.py hello.py # on OS X 10.5.7 $ uname -a Darwin 9.7.0 Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009; root:xnu-1228.12.14~1

[issue6373] SystemError in encoder

2009-06-29 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: gdb trace Breakpoint 1, _PyBytes_Resize (pv=0xbfffec3c, newsize=-495723) at Objects/bytesobject.c:3179 3179if (!PyBytes_Check(v) || Py_REFCNT(v) != 1 || newsize 0) { (gdb) where #0 _PyBytes_Resize (pv=0xbfffec3c, newsize=-495723

[issue6373] SystemError in encoder

2009-06-29 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Confirmed patch and test are working -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6373

[issue6375] compile failure in Modules/python.c

2009-06-29 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: On OpenBSD by chance? Looks similar to Issue4146 -- nosy: +jcsalterego ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6375

[issue6233] ElementTree (py3k) doesn't properly encode characters that can't be represented in the specified encoding

2009-06-26 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Either way, it would be nice to get feedback so we can iterate on the patch or close out this issue already :-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6233

[issue6243] getkey() can segfault in combination with curses.ungetch()

2009-06-25 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Verified Bus Error with code snippet in python 2.7 and 3.1 trunks r73552, e.g.: (gdb) where #0 0x925f6f30 in strlen () #1 0x0005ea10 in PyString_FromString (str=0x0) at Objects/stringobject.c:125 #2 0x003c1710 in PyCursesWindow_GetKey (self

[issue6243] getkey() can segfault in combination with curses.ungetch()

2009-06-25 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Trundle's original patch against r73301 still works currently, but I made a minor tweak and rediff'd. The attached patch is against 2.7 - r73552. I added knp usage to the NetBSD #ifdef region so a) the compiler doesn't complain about unused

[issue6243] getkey() can segfault in combination with curses.ungetch()

2009-06-25 Thread Jerry Chen
Changes by Jerry Chen je...@3rdengine.com: Removed file: http://bugs.python.org/file14362/issue6243-py2.7-cursesmodule.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6243

[issue6243] getkey() can segfault in combination with curses.ungetch()

2009-06-25 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Sorry -- bad patch, uploading correct one. -- Added file: http://bugs.python.org/file14363/issue6243-py2.7-cursesmodule.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6243

[issue6243] getkey() can segfault in combination with curses.ungetch()

2009-06-25 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Another patch for the same code change but against the 3.1 branch. -- versions: +Python 3.0, Python 3.1 Added file: http://bugs.python.org/file14364/issue6243-py3.1-cursesmodule.diff ___ Python

[issue6342] io.path.ismount gives local variable 'p' referenced before assignment error on Windows versions (ntpath.py)

2009-06-25 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Duplicate of http://bugs.python.org/issue5595 Fixed in r70676 -- nosy: +jcsalterego ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6342

[issue6341] io.path.ismount gives local variable 'p' referenced before assignment error on Windows versions (ntpath.py)

2009-06-25 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Duplicate of http://bugs.python.org/issue5595 Fixed in r70676 -- nosy: +jcsalterego ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6341

[issue6315] locale._build_localename(locale.getdefaultlocale()) returns 'C.mac-roman'

2009-06-25 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Also seeing this was resolved by Issue6202. Python 3.1rc2+ (py3k:73552, Jun 24 2009, 23:11:23) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type help, copyright, credits or license for more information. import locale locale

[issue6233] ElementTree (py3k) doesn't properly encode characters that can't be represented in the specified encoding

2009-06-24 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Thanks for the explanation -- looks like I was way off base on that one. I took a look at the code you provided but it doesn't work as a drop-in replacement for _escape_cdata, since that function returns a string rather than bytes. However

[issue6233] ElementTree (py3k) doesn't properly encode characters that can't be represented in the specified encoding

2009-06-22 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: The attached patch includes Neil's original additions to test_xml_etree.py. I also noticed that _encode_entity wasn't being called in ElementTree in py3k, with the important bit being the nested function escape_entities(), in conjunction

timeit and __future__

2009-06-19 Thread Karl Chen
I wanted to time something that uses with_statement, in python2.5. Importing __future__ in the statement or the setup doesn't work since it's not the beginning of the code being compiled. Other than using a separate module, I could only come up with this: timeit.template = 'from __future__

[issue6297] Added Misc/python.pc to 'distclean' Rule

2009-06-17 Thread Jerry Chen
New submission from Jerry Chen je...@3rdengine.com: Added Misc/python.pc to 'distclean' rule Minor issue... After running ./configure, Misc/python.pc is generated from python.pc.in. Interesting to note in the python2.7 trunk, this file is added to the svn:ignore property of Misc/ so it doesn't

[issue6297] Added Misc/python.pc to 'distclean' Rule

2009-06-17 Thread Jerry Chen
Jerry Chen je...@3rdengine.com added the comment: Errata: the patch is for Makefile.pre.in, not Makefile. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6297

how to import MV module

2009-05-14 Thread guangshan chen
Hi all, I am new. I just want to run a python program. When I run it, python can not find MV module. The follow is the error information: Traceback (most recent call last): File MakeCouplerRestart.py, line 22, in module import MV,struct,Numeric,string ImportError: No module named MV

Re: how to import MV module

2009-05-14 Thread guangshan chen
: guangshan chen wrote: Hi all, I am new. I just want to run a python program. When I run it, python can not find MV module. The follow is the error information: Traceback (most recent call last): File MakeCouplerRestart.py, line 22, in module import MV,struct,Numeric,string ImportError

[issue5802] The security descriptors of python binaries in Windows are not strict enough

2009-04-20 Thread Hong Chen
New submission from Hong Chen cn.hongc...@gmail.com: The security descriptors of python binaries (like python.exe, pythonw.exe, etc) allow any Authenticated Users to modify these binaries. This may cause a privilege-escalation problem since administrators may use python binaries when performing

[issue4550] Deprecated python 2.x syntax in HOWTO Use Python in the web

2008-12-05 Thread Jerry Chen
New submission from Jerry Chen [EMAIL PROTECTED]: For people who are following HOWTO guides verbatim, there are two types of Python 2.x'isms in HOWTO Use Python in the web (http://www.python.org/doc/3.0/howto/webservers.html): 1. ``print`` statements instead of functions. 2. Use of beloved

socket.getaddrinfo: flags |= AI_ADDRCONFIG

2008-11-05 Thread Karl Chen
I've discovered that since glibc 2.3.2, getaddrinfo(3) supports a useful flag called AI_ADDRCONFIG. It turns off lookups if the machine isn't configured for IPv6 (and similarly for IPv4, theoretically). This is especially important when behind gateways whose DNS forwarder silently filter

a question about Chinese characters in a Python Program

2008-10-19 Thread Liang Chen
of the error message I received after I logged off the program: Could not write output: type exceptions: UnicodeEncodeError', 'ascii' codec can't encode characters in position 0-1: ordinal not in range (128) Any suggestion will be appreciated. Sincerely, Liang Liang Chen,Ph.D. Assistant

Re: help on import libxml2

2008-08-15 Thread jianbing . chen
Paul, Thanks. This helped. Jianbing On Aug 14, 4:10 pm, Paul Boddie [EMAIL PROTECTED] wrote: On 14 Aug, 22:43, [EMAIL PROTECTED] wrote: Traceback (most recent call last):   File stdin, line 1, in module   File /sea/local/lib/python2.5/site-packages/libxml2.py, line 1, in module    

help on import libxml2

2008-08-14 Thread jianbing . chen
Hi, I have this weird situation where on the same machine(solaris 8, python 2.5), one user can do this with no problem: import libxml2 libxml2 module 'libxml2' from '/usr/local/lib/python2.5/site-packages/ libxml2.py' While the another one get this: import libxml2 Traceback (most recent

default method parameter behavior

2008-04-02 Thread jianbing . chen
I ran into a similar situation like the following (ipython session). Can anyone please explain why the behavior? Thanks in advance. In [11]: def foo(b=[]): : b.append(3) : return b : In [12]: foo() Out[12]: [3] In [13]: foo() Out[13]: [3, 3] In [14]: foo([])

How to pass shell variable to shell script from python

2008-02-26 Thread Rockins Chen
, it didn't work. What can I do? TIA, -- BRs, Rockins Chen UESTC, Chengdu, Sichuan, China http://www.dormforce.net/blog/rockins http://rockins.cublog.cn [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: How to pass shell variable to shell script from python

2008-02-26 Thread Rockins Chen
Clearly, I made some typing mistake, it's the shbang line! it should be: #!/usr/bin/python then, just set os.environ is okay: os.environ[target] = localhost.localdomain.org according python's documentation, setting os.environ will implicitly call os.putenv(). 2008/2/27, Rockins Chen [EMAIL

How to implement function like this?

2007-10-23 Thread Yinghe Chen
Hello gurus, I have a question, a function like below, it is implemented by me, :) def funcA(tarray): a = [2,3,4] if len(tarray) =3: return a[0],a[1], a[2] elif len(tarray) == 2: return a[0],a[1], funcB(1)[0] elif len(tarray) == 1:

[issue1134] Parsing a simple script eats all of your memory

2007-09-16 Thread Alexey Suda-Chen
Alexey Suda-Chen added the comment: Oops, i see there are two bugs. Previously i have fixed multiline strings only. I think it will be: Index: tokenizer.c === --- tokenizer.c (revision 58161) +++ tokenizer.c (working copy

[issue1134] Parsing a simple script eats all of your memory

2007-09-15 Thread Alexey Suda-Chen
Alexey Suda-Chen added the comment: --- tokenizer.c (revision 58161) +++ tokenizer.c (working copy) @@ -402,6 +402,8 @@ if (allocated) { Py_DECREF(bufobj); } + Py_XDECREF(tok-decoding_buffer); + tok-decoding_buffer = 0; return s; -- nosy

Re: how to get next month string?

2007-07-25 Thread Yinghe Chen
John's method works perfectly, thanks all for your kind help. John Machin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jul 24, 8:31 pm, Yinghe Chen [EMAIL PROTECTED] wrote: Hi, Could someone help on how to use python to output the next month string like this? AUG07

how to get next month string?

2007-07-24 Thread Yinghe Chen
in advance, Yinghe Chen -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get next month string?

2007-07-24 Thread Yinghe Chen
My bad, for Dec 07, it shall output as JAN08. Yinghe Chen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Could someone help on how to use python to output the next month string like this? AUG07, suppose now is July 2007. I think also need to consider Dec 07 case

Re: behavior difference for mutable and immutable variable in function definition

2007-05-05 Thread jianbing . chen
On May 4, 5:14 pm, Carsten Haese [EMAIL PROTECTED] wrote: On Fri, 2007-05-04 at 14:30 -0700, [EMAIL PROTECTED] wrote: Hi, Can anyone explain the following: Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 Type help, copyright, credits or

behavior difference for mutable and immutable variable in function definition

2007-05-04 Thread jianbing . chen
Hi, Can anyone explain the following: Python 2.5 (r25:51908, Apr 9 2007, 11:27:23) [GCC 4.1.1 20060525 (Red Hat 4.1.1-1)] on linux2 Type help, copyright, credits or license for more information. def foo(): ... x = 2 ... foo() def bar(): ... x[2] = 2 ... bar() Traceback (most recent

[OT]Could anyone send me a copy of timeout sockets for jython

2007-01-24 Thread Slowness Chen
The information about this module: http://www.xhaus.com/alan/python/timeout.html I can't access the download url due to the severe network issue these days, and I need to use this module for work. Could anyone do me a favor to send a copy? the download url :

how to invoke the shell command and then get the result in python

2006-12-04 Thread Bin Chen
Hi, I want to do following: get a user input regex, then pass this as a parameter to grep, and then get the result from grep. Any code snip to implement the similar function? I am a python newbie. Thanks a lot. Bin -- http://mail.python.org/mailman/listinfo/python-list

the same strings, different utf-8 repr values?

2006-09-07 Thread slowness . chen
I have two files: test.py: -- # -*- encoding : utf8 -*- print 'in this file', repr('中文') # tt.txt is saved as utf8 encoding f = file('tt.txt') line1 = f.readline().strip() print 'another file', repr(line1)

Re: the same strings, different utf-8 repr values?

2006-09-07 Thread Slowness Chen
got it. thanks. John Machin 写道: [EMAIL PROTECTED] wrote: I have two files: test.py: -- # -*- encoding : utf8 -*- print 'in this file', repr('中文') # tt.txt is saved as utf8 encoding f = file('tt.txt') line1 = f.readline().strip()

error occurs when using wmi module in child thread

2006-07-11 Thread Chen Houwu
, **self.__kwargs) File F:\chen\code\SoftRepairer\script\test\test.py, line 6, in run c = wmi.WMI () File C:\my\Python24\Lib\site-packages\wmi.py, line 971, in connect handle_com_error (error_info) File C:\my\Python24\Lib\site-packages\wmi.py, line 219, in handle_com_error raise x_wmi

Re: error occurs when using wmi module in child thread

2006-07-11 Thread Chen Houwu
thanks to solve my big problem :-) I will try it later. -- http://mail.python.org/mailman/listinfo/python-list

How to show percentage

2005-09-22 Thread Sen-Lung Chen
Dear All: I have a question of show percentage. For example ,I want to show the percentage of 1/3 = 33.33% I use the 1*100/3 = 33 it is 33 not 33.33 , how to show the 33.33 % Thanks -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3