Re: A python IDE for teaching that supports cyrillic i/o

2006-11-19 Thread Leo Kislov
> That is IDLE + python 2.4 on Windows. So I'm not sure what is the problem. In other messages you seems to be talking about system console. Why? It's not part of IDE. And another question: are you aware of the fact that recommended way to handle non-ascii characters is to use unicode type? Most of IDEs should work fine with unicode. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: A python IDE for teaching that supports cyrillic i/o

2006-11-19 Thread Leo Kislov
Kirill Simonov wrote: > On Sun, Nov 19, 2006 at 03:27:32AM -0800, Leo Kislov wrote: > > IDLE on Windows works fine for your example in interactive console: > > > > >>> name = raw_input("What's your name? ") > > Have you tried to use cyrillic cha

Re: Email headers and non-ASCII characters

2006-11-24 Thread Leo Kislov
7;"Jörg Nørgens" <[EMAIL PROTECTED]>' def is_ascii(char): return ord(char) < 128 for ascii, group in groupby(addr, is_ascii): h.append(''.join(group),"latin-1") print h => "J =?iso-8859-1?q?=F6?= rg N =?iso-8859-1?q?=F8?= rgens" <[EMAIL PROTECTED]> -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to increase the speed of this program?

2006-11-28 Thread Leo Kislov
ython25>python -m timeit -s"from array import array; N = 10**6" "a =array('h'); a.fromstring('\0'*(2*N))" 100 loops, best of 3: 9.57 msec per loop C:\Python25>python -m timeit -s"from array import array; N = 10**6" "a = array('h','\0\0'); a*N" 10 loops, best of 3: 28.4 msec per loop Perhaps if array multiplication was as smart as string multiplication then array multiplication version would be the fastest. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to increase the speed of this program?

2006-11-28 Thread Leo Kislov
ot; "a =array('h'); a.fromstring('\0'*(2*N))" 100 loops, best of 3: 9.57 msec per loop C:\Python25>python -m timeit -s"from array import array; N = 10**6; b = array('h', [0])*(N/2); c = b[:]" "a = b + c" 100 loops, best of 3: 5.7 msec per loop -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Leo Kislov
py: wanted = input[:] wanted[1::2] = [-item for item in wanted[1::2]] -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: os.walk return hex excapes

2006-11-28 Thread Leo Kislov
emp'). The exact code how to make the first parameter unicode depends on where it is coming from (network, config file, registry, etc...) Reading unicode tutorial is highly recommended. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Leo Kislov
f/lists.html [blah for x in expr] and [blah for x in expr if cond] And here is reference page for slicing (note, it's not list comprehension): http://docs.python.org/ref/slicings.html -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Leo Kislov
> from somemodule import ISomeInteface > > d = compile(sourcecode) > > myfoo = d.Foo() > > print ISomeInterface in myfoo.__bases__ > > Any hints? Here is hello world program for plugins: import sys somecode = """ class Foo: param1 = "Hello, world!&qu

Re: Problem with imaplib (weird result if mailbox contains a %)

2006-11-28 Thread Leo Kislov
ot;user/cpapen/wm2addressbook"' > '(\\HasNoChildren) "/" "user/cpapen/wm2prefs"' > '(\\HasNoChildren) "/" "user/cpapen/wm2signature"' > > > What I have a problem with is the 14th and 15th line. > All other entries are strings but the 14th is a tuple. > and the 15th is an empty string. As far as I can tell > every time a "%" is in the mailbox name I get this kind of > result. > > I'm using python 2.3.3 and the imap sytem is Cyrus. > > Can someone explain what is going one? > > Is this a bug? Empty string seems to be a bug. But tuple is by design, read the docs and imap rfc. The protocol is convoluted in the first place, and so is python interface. > If it is, is it fixed in later versions? Why don't you try to pull imaplib.py from later versions? I don't think it changed that much so it should be compatible with python 2.3 > Whether or not it is a bug, can I rely on the mailbox > being the last item in the tuple in these cases? Yes (at least for list command) -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem with imaplib (weird result if mailbox contains a %)

2006-11-29 Thread Leo Kislov
Antoon Pardon wrote: > On 2006-11-28, Leo Kislov <[EMAIL PROTECTED]> wrote: > > > > Antoon Pardon wrote: > >> This little program gives IMO a strange result. > >> > >> import imaplib > >> > >> user = "cpapen" >

Re: Printing Barcodes from webapp?

2006-12-02 Thread Leo Kislov
of the easiest ways is to install acrobat reader and redirect client browser to a generated pdf file. http://www.reportlab.org/ has support for generating barcodes (and more) in pdf documents. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdin.encoding

2006-12-11 Thread Leo Kislov
your case is: in the beginning of your program: import sys if hasattr(sys.stdin, 'encoding'): console_encoding = sys.stdin.encoding else: import locale locale_name, console_encoding = locale.getdefaultlocale() and later: uni = unicode(word, console_encoding) But don't think it's portable, if you use other IDE or OS, it may not work. It would be better if PyDev implemented sys.stdin.encoding -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdin.encoding

2006-12-11 Thread Leo Kislov
aries, terminals, etc. It's not really Python only problem. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to turn of the monitor by python?

2006-12-12 Thread Leo Kislov
e this <http://www.codeproject.com/system/display_states.asp> C API calls into python. You can use ctypes (included in Python 2.5) or python win32 extensions. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: how can i write a hello world in chinese with python

2006-12-13 Thread Leo Kislov
e file? > Maybe python doesn't know I'm to use chinese?! It depends on how EasyDialogs works. And by the way, when you say utf-8 encoded text is not displayed correctly, what do you actually see on the screen? -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: inconvenient unicode conversion of non-string arguments

2006-12-13 Thread Leo Kislov
a property of bytes, it is not applicable to other objects. > Or some good solution to work around my problem? Do not put undecoded bytes in a mixed-type argument list. A rule of thumb working with unicode: decode as soon as possible, encode as late as possible. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: inconvenient unicode conversion of non-string arguments

2006-12-13 Thread Leo Kislov
really see from your example what stops you from putting unicode instead of bytes into your tree, but I can believe some libraries can cause some extra work. That's the problem with libraries, not with builtin function unicode(). Would you be happy if floating point value 17.3 would be stored as 8 bytes in your tree? After all, that is how 17.3 is actually represented in computer memory. Same story with unicode, if some library gives you raw bytes *you* have to do extra work later. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: connect from windows to linux using ssh

2006-12-15 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Hi Folks, > > How to connect from windows to linux using ssh without username/passwd. > > With this scenario, i need to write a program on python. Use ssh library http://cheeseshop.python.org/pypi/paramiko -- Leo -- http://mail.python.org/mailman/

Re: Serial port failure

2006-12-15 Thread Leo Kislov
t and it will be fixed in python 3.0 (it will raise exception) I think you should rewrite GetAck to return a tuple (state, lane) def GetAck(p): response = "" try: response = p.readline() except SerialException: print ">>>>>Timed out<<

Designing a cancellable function

2006-12-15 Thread Leo Breebaart
ow, and I am wondering if this way the whole API for foo() won't become to complex and overdesigned. I was wondering if anybody has any insights or best practice recommendations for me here. Do I keep the function interface? Do I use a class? Any other solution I am overlooking? Many thanks i

Re: Serial port failure

2006-12-15 Thread Leo Kislov
least write it to a log file): except SerialException, err: print err print ">>>>>Timed out<<<<<" except OSError, err: print err print "Serial port failure. Power cycle units" and in your OpenPort function too. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Roundtrip SQL data especially datetime

2006-12-15 Thread Leo Kislov
. Python datetime module excepts years from 1 up to : >>> datetime.MINYEAR 1 >>> datetime.MAXYEAR -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: writing serial port data to the gzip file

2006-12-17 Thread Leo Kislov
s kind of loop are implemented using iterators. Check if your s object (is it from external library?) already implements iterator. If it does then for data in s: g.write(data) is all you need. If it doesn't, you can use iter to create iterator for you: for data in iter(s.readLine, ''): g.write(data) -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Leo Kislov
y time you say "I get error" please provide source code where this error occurs. And by the way, do you know that for non-ascii characters you should use unicode type, not str type? -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: urllib.unquote and unicode

2006-12-18 Thread Leo Kislov
he results is right. Either unicode string should be rejected by raising ValueError or it should be encoded with ascii encoding and result should be the same as urllib.unquote(u'%94'.encode('ascii')) that is '\x94'. You can consider current behaviour as undefined just

Re: INSERT statements not INSERTING when using mysql from python

2006-12-29 Thread Leo Kislov
Ask Ben, he might know, although he's out to lunch. Ben wrote: > I'll try it after lunch. Does anyoone know whether this might be the > problem? > > Ben > > > Ben wrote: > > I have found the problem, but not the cause. > > > > I tried setting the database up manually before hand, which let me get

tempfile.gettempdir() result on Windows

2005-06-03 Thread Leo Breebaart
tirely cosmetic, but still) is that I also need to show this location to the users of my program, who I suspect would be much happier with a 'proper' Windows path than with this '~1' DOS malarkey. Does anybody know how I can obtain a temp directory in 'verbose' fo

Sending mail from 'current user' in Python

2005-06-10 Thread Leo Breebaart
n improvement, portability-wise. Finally, if at all possible I'd also like to get this working on Windows, so I'd rather stick with the standard smtplib if I can. Does anybody here have any thoughts on this? -- Leo Breebaart <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Sending mail from 'current user' in Python

2005-06-14 Thread Leo Breebaart
nherent non-portabilitiness of the whole concept of 'sending mail from within a program', and will be going with a Unix-only see-if-you-can-find-sendmail approach. -- Leo Breebaart <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Re: Python memory handling

2007-06-01 Thread Leo Kislov
ict() for i in range(88)] If it doesn't help that means 1) list&dict caches don't really work like I think or 2) pymalloc cannot return memory because of fragmentation and that is not simple to "fix". -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to wrap a Japanese text in Python

2007-06-08 Thread Leo Kislov
--- Result: Can you post a short example that clearly demonstrates the problem? -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to wrap a Japanese text in Python

2007-06-08 Thread Leo Kislov
On Jun 8, 2:24 am, Leo Kislov <[EMAIL PROTECTED]> wrote: > On Jun 7, 5:12 am, [EMAIL PROTECTED] wrote: > > > Hi All, > > > I am trying to wrap a japanese text in Python, by the following code. > > > if len(message) > 54: > >message = message.

Re: Method much slower than function?

2007-06-13 Thread Leo Kislov
> > 20004 function calls in 10.214 CPU seconds > >>> cProfile.run("z=r.readgenome(open('cb_foo'))") > > 20004 function calls in 0.041 CPU seconds > I suspect open files are cached so the second reader picks up where the first one left:

Re: String formatting for complex writing systems

2007-06-27 Thread Leo Kislov
back from rendering library. Assuming you use *fixed* font for English and Thai the following function will return how many columns your text will use: from unicodedata import category def columns(self, s): return sum(1 for c in s if category(c) != 'Mn') -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: String formatting for complex writing systems

2007-06-27 Thread Leo Kislov
On Jun 27, 3:10 am, Leo Kislov <[EMAIL PROTECTED]> wrote: > On Jun 27, 12:20 am, Andy <[EMAIL PROTECTED]> wrote: > > > Hi guys, > > > I'm writing a piece of software for some Thai friend.  At the end it > > is supposed to print on paper some report with

Re: Portable general timestamp format, not 2038-limited

2007-06-28 Thread Leo Kislov
e zero time point (just like OP wanted). TAI timestamps are pretty useless IMHO. They need to be converted to decimal/float for interval calculations and they don't represent any legal time. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Python's handling of unicode surrogates

2007-04-22 Thread Leo Kislov
wierd. When the programmer is *ready* to support unicode he/she will explicitly call .codepoints() or .graphemes(). As they say: You can lead a horse to water, but you can't make it drink. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

anyone has experience on cross-compile python 2.5.1?

2007-04-30 Thread Leo Jay
push("world\n") asyncore.loop() s.join() but the weirdest thing is, if i run python test_asynchat.py directly, everything is ok. anybody could help me? thanks in advance. ps, my linux box is an ubuntu 6.10. -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: hp 11.11 64 bit python 2.5 build gets error "import site failed"

2007-05-03 Thread Leo Kislov
" of convertsimple() - sure it is. However, how > did it get there? It's in an argument tuple - and where came > that from? Looking at the call stack OP posted, -1 is coming as forth parameter of __import__, I *guess* at the first import in site.py or at implicit "import sit

Re: My Python annoyances

2007-05-03 Thread Leo Kislov
commented further. > I would have changed the status to "invalid" myself, if I were able to do > so. I think it should have been marked as "won't fix" as it's a wart just like 1/2 == 0, but as there are many users of the current behaviour it's "

Re: relative import broken?

2007-05-03 Thread Leo Kislov
) would > be useful for a script? (I.e., more useful than importing relative > to the directory holding the script, as indicated by __file__.) Do you realize it's a different behaviour and it won't work for some packages? One possible alternative is to assume empty parent package and let

default config has no md5 module?

2007-05-04 Thread Leo Jay
i want to compile a python by myself, but after configure and make, it seems that md5 is not built by default. what should i do to compile md5 as an module? -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: anyone has experience on cross-compile python 2.5.1?

2007-05-04 Thread Leo Jay
On 4/30/07, Leo Jay <[EMAIL PROTECTED]> wrote: > i have a development board based on s3c2410 arm cpu. and i want to > port python on it. > after googling some threads, i successfully cross compiled python. > but i still encountered a weird issue that when i ran > /lib/pyth

Re: getmtime differs between Py2.5 and Py2.4

2007-05-07 Thread Leo Kislov
16.384 bytes allocated > 287.555.584 bytes free > > [E:\Projects]c:\Python24\python.exe -c "import os; print > os.path.getmtime('p64.py')" > 1164470381 > > [E:\Projects]c:\Python25\python.exe -c "import os; print > os.path.getmtime('p64.py&#

Re: invoke user's standard mail client

2007-05-07 Thread Leo Kislov
le blank. Do I need MS > Exchange Server to run this demo? No, but you need an account on some mail server and some email program should create a MAPI profile to represent that account on your local computer. As I understand creation of MAPI profiles is not a common practice among non-Microsoft products, for example my computer with Lotus Notes doesn't have any MAPI profiles. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: From D

2007-07-26 Thread Leo Petr
On Jul 24, 10:10 am, Stargaming <[EMAIL PROTECTED]> wrote: > On Tue, 24 Jul 2007 03:19:53 -0700, bearophileHUGS wrote: > > There are various things I like about the D language that I think Python > > too may enjoy. Here are few bits (mostly syntactical ones): > > > 1) (we have discussed part of thi

Re: lock problem

2007-03-15 Thread Leo Kislov
not designed for that kind of usage, it was designed for settings. Either use an option to set output file or just redirect stdout. If the interface of ldapsearch is so lame that it requires environmental variable use env to set the variable: "env __kabc_ldap=/tmp/wrjhdsf ldapsearch ..." -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: lock problem

2007-03-16 Thread Leo Kislov
On Mar 16, 12:40 am, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Leo Kislov wrote: > > You're changing environmental variable __kabc_ldap that is shared > > between your threads. Environment is not designed for that kind of > > usage, it was designed for setti

Re: lock problem

2007-03-18 Thread Leo Kislov
On Mar 16, 3:08 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Leo Kislov wrote: > > But you miss the fact that there is only one environment per process. > > Maybe there's a confusion. > The environment variable that I'm setting has noting to do with l

Re: Making a non-root daemon process

2007-03-23 Thread Leo Kislov
; How can I get that without being > the root user? Maybe you can go over the list of all possible signals from the terminal and notify kernel that you want to ignore them. Sounds similar to dettaching from the terminal, but maybe there some differences. But the fact that os.setsid fails for you is weird anyway. -- Leo. -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode zipping from Python code?

2007-03-26 Thread Leo Kislov
ng that can handle the characters good, or > handle the unicode filenames. You said you've got good result, so it's not clear what do you want. > Does anyone knows about a python project that can do this? > Or other tool what I can use for zipping intern. characters? Zipp

Re: shutil.copy Problem

2007-03-26 Thread Leo Kislov
output: > exceptions.UnicodeDecodeError > 'ascii' codec can't decode byte 0xd6 in position 26: ordinal not in > range(128)] > > What could the possible cause of this be? Show us traceback, without it I doubt anyone can help. > Shouldn't shutil simply be &

Re: I18n issue with optik

2007-04-01 Thread Leo Kislov
f sys.stdout to another encoding? What are you going to set it to? As I understand you're going to distribute your program to some users. How are you going to find out the encoding of the terminal of your users? -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: shutil.copy Problem

2007-04-01 Thread Leo Kislov
everywhere in your program is a complete solution. Like shutil.copy(xmlfile, u"C:\iTunes Music Library.xml") if you use constant or make sure your file name is unicode: dest = unicode() shutil.copy(xmlfile, dest) -- Leo. -- http://mail.python.org/mailman/listinfo/python-list

Re: iterator interface for Queue?

2007-04-08 Thread Leo Kislov
#x27;s a personal preference, I usually put as many quit sentinels in a queue as many consumers. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: japanese encoding iso-2022-jp in python vs. perl

2007-10-24 Thread Leo Kislov
#x27;.translate(iso2022_squeezing)) It prints u'\u30e1'. Feel free to ask questions if something is not clear. Note, this is just an example, I *don't* claim it does what you want for any character in FF61-FFDF range. You may want to carefully review the whole unicode block: http://www.unicode.org/charts/PDF/UFF00.pdf -- Leo. -- http://mail.python.org/mailman/listinfo/python-list

how to use xmlrpc properly in windows xp

2007-01-16 Thread Leo Jay
"; % ('192.168.0.92', 31281)) start = datetime.now() print server.test() print server.test() print server.test() print server.test() print 'total: ', datetime.now() - start -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I write code using FP

2007-01-16 Thread Leo Jay
rint foo1(3) print foo2(3) -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

How to doctest if __name__ already used?

2006-05-05 Thread Leo Breebaart
own, what is then the easiest yet still most Pythonic way to run doctest on the docstrings in the file? Trigger doctest.testmod() via a "--test" command-line option, is what I'm thinking. But is that really the best way? -- Leo Breebaart <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Passing options around your program

2006-05-07 Thread Leo Breebaart
hes, and/or are there perhaps possibilities I have overlooked? Many thanks in advance for your feedback. -- Leo Breebaart <[EMAIL PROTECTED]> -- http://mail.python.org/mailman/listinfo/python-list

Logging vs printing

2006-05-08 Thread Leo Breebaart
"alisonken1" <[EMAIL PROTECTED]> writes: > Leo Breebaart wrote: > > > I am writing fairly large console scripts in Python. They > > have quite a few command-line options, which lead to > > configuration variables that are needed all over the program > &

Re: Logging vs printing

2006-05-08 Thread Leo Breebaart
Sybren Stuvel <[EMAIL PROTECTED]> writes: > Leo Breebaart enlightened us with: > > I think the main reason why I am not using [logging] by > > default is because, when all is said and done, it still comes > > easier to me to resort to guarded print statements the

Re: C++ equivalent of comp.lang.python?

2008-01-06 Thread Leo Jay
y one manually. > > For those of you who work in C++, where do you go to discuss it > online? I'm interested in any newsgroups, mailing lists, or web > boards you can recommend. > -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

PyHyphen-0.2.1a - OpenOffice-like hyphenation

2008-02-13 Thread Dr. leo
Hi, a couple of weeks ago I uploaded PyHyphen-0.1 on the PyPI. It is a wrapper around the C library "hnj_hyphen 2.3" that ships with OpenOffice and Mozilla products. You can have a look at PyHyphen at http://pypi.python.org/pypi/PyHyphen/0.2.1a I've tested it on Linux, but it should also run on

Hyphenation module PyHyphen-0.3 released

2008-02-23 Thread Dr. leo
ld be terrific. Bests Leo -- http://mail.python.org/mailman/listinfo/python-list

Hyphenation module PyHyphen-0.4 released - good news for Windows users

2008-02-26 Thread Dr. leo
#x27;s and web development frameworks. Although I would be happy to give it a first go on textwrap, I fear I won't find the time in the coming weeks. Spring is ahead in my country after all... So if you wish to contribute, the above bullets may be good starting points. Thanks again and en

Hyphenation: PyHyphen 0.4.1 and textwrap2-0.1.1 released

2008-03-02 Thread Dr. leo
This latest version of PyHyphen is only important for Python 2.4 addicts who encountered a missing type when compiling. Further, a few signed/unsigned mismatch warnings coming from MSVC should be fixed. As I have only Python 2.5, I'd be interested in any experiences when compiling it with Python 2.

Why optimization mode is slower than normal mode?

2008-12-11 Thread Leo Jay
1) time for 50 passes = 6.00515 This machine benchmarks at 83261.8 pystones/second I tried many times, and get the same result. Why optimization mode is slower than normal mode? -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent of 'wget' for python?

2008-12-11 Thread Leo Jay
indows. I'm hoping the core python library has > a library for this. Note that I'll be using Python 3.0. > You can get Wget for Windows here: http://gnuwin32.sourceforge.net/packages/wget.htm -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Why %e not in time.strftime directives?

2008-12-13 Thread Leo jay
Any special reasons? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Why %e not in time.strftime directives?

2008-12-13 Thread Leo Jay
on, and platform variations are common. > > So if your underlying C implementation of strftime() supports "%e", then > Python will. My guess is that the same applies to time.strftime as it does > to datetime.strftime > > The docs list ones that are fairly cross-platform. However, it would seem > that not all platforms support "%e" > > > -tkc > > > [1] > http://docs.python.org/library/datetime.html#module-datetime > > -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

why can i still able to reproduce the SimpleHTTPServer bug which is said fixed 3 years ago?

2008-06-13 Thread Leo Jay
r("Content-Length", str(fs[6]))# <-- obviously, this is not the same with len(f.read()) in windows. -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: Does '!=' equivelent to 'is not'

2008-06-16 Thread Leo Jay
r of python: >>> a = 10 >>> b = 10 >>> a is b False >>> a == b True >>> a = 5 >>> b = 5 >>> a is b True >>> a == b True >>> which is caused by small object cache mechanism. -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

wxPython: How can I get window's HANDLE in wxPython.

2008-07-02 Thread Leo Lee
I need a window's handle to be passed to external c++. Thanks in advance -- http://mail.python.org/mailman/listinfo/python-list

wxpython: visual effects missing after py2exe

2008-07-16 Thread Leo Lee
Please take close look at the details of the two snapshots. I need explanation and correcting this problem. begin 666 after.png MB5!.1PT*&@[EMAIL PROTECTED];0```#-" ,```#GL'7)`7-21T(`KLX< MZ01G04U!``"[EMAIL PROTECTED]>B8``("[EMAIL PROTECTED]@``'4P M``#J8 [EMAIL PROTECTED]/ ```P!03%1%

Re: wxPython: How can I get window's HANDLE in wxPython.

2008-07-16 Thread Leo Lee
Thank you , Mike. "Mike Driscoll" <[EMAIL PROTECTED]> ??:[EMAIL PROTECTED] On Jul 2, 8:40 pm, "Leo Lee" <[EMAIL PROTECTED]> wrote: > I need a window's handle to be passed to external c++. > Thanks in advance Are you talking about a wxPython wx.Win

Re: wxpython: visual effects missing after py2exe

2008-07-16 Thread Leo Lee
"optimize": 2, "ascii": 1, "bundle_files": 1}}, zipfile = None, windows = [test_wx], ) "Leo Lee" <[EMAIL PROTECTED]> дÈëÏûÏ¢ÐÂÎÅ:[EMAIL PROTECTED] > Please take close look at the details of the two snapshots. > I need explanation and correcting this problem. > > -- http://mail.python.org/mailman/listinfo/python-list

logging into a website using python

2008-07-23 Thread leo davis
Hi,   I''m trying achieve the following by running python programs -login to a website -automate filling up web forms   So far I 've tried out the following codes: import cookielib, urllib, urllib2 login = 'cod45' password = 'mell' # Enable cookie support for urllib2 cookiejar = cookielib.Cooki

need help with introducing more traffic

2008-07-24 Thread leo davis
Hiya, I found this code snippet(reference http://www.goldb.org) and wish to do more with it than just send out a Http Get request.I would like to introduce more traffic -say by downloading files,crawling through all the links,logging in etc etc,and wish to see how the web server reacts.I'm tryin

Re: need help with introducing more traffic

2008-07-25 Thread leo davis
Fredrik Lundh,   I'm with you and my apologies for not making the scenario more clearer in my previous post [QUOTE]"load testing" other people's sites are known as something else, of course[QUOTE]-    yes,that could cause a DoS and its lameI certainly dont intend to do that,was just chec

virtual IPs

2008-08-06 Thread leo davis
Good Day! I have set up virtual IPs on my Ubuntu client machine & assigned IPs 192.168.12.3 - eth0 192.168.12.4 - eth0:1 192.168.12.5 - eth0:2 192.168.12.6 - eth0:3 I have written python code to send multiple HTTP requests to my web server to load test it.When I check the logs on the apache serve

Hyphenation: PyHyphen-0.7 released

2008-04-02 Thread Dr. leo
'ful']] print h_en.wrap('beautiful', 6) [u'beau-', u'tiful'] print h_en.wrap('beautiful', 7) [u'beauti-', u'ful'] from textwrap2 import fill print fill('very long text...', width = 40, use_hyphens = h_en) My thanks go to those who helped enormously with advice, suggestions, criticism and Windows builds. Regards Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: How to stop iteration with __iter__() ?

2008-08-19 Thread Leo Jay
ntation it should. But catching an exception > can't be the standard way to stop iterating right? > you can use for loop: for line in movie_iter: ... -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

How to read and write the same socket in different threads?

2008-08-22 Thread Leo Jay
te port, the program works. But if the first element of the tuple is 's', the program doesn't work. Is it possible to read and write the same socket in different threads? Thanks in advance. -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: How to read and write the same socket in different threads?

2008-08-22 Thread Leo Jay
On Sat, Aug 23, 2008 at 1:58 AM, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Sat, 23 Aug 2008 01:47:23 +0800, Leo Jay <[EMAIL PROTECTED]> wrote: >> >> I'd like to read and write the same socket in different threads. >> one thread is only used to read

Re: Generate alphabet?

2008-08-23 Thread Leo Jay
gt; ','.join(string.ascii_lowercase) 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z' >>> -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalents of Ruby's "!" methods?

2008-08-25 Thread Leo Jay
this is not an accepted > and pythonic way of doing things then please let me know... and I'll > stop! > how about this one: >>> h = { "1" : "a\r", "2" : "b\n" } >>> dict((k, h[k].strip()) for k in h) {'1': 'a', '2': 'b'} >>> -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

ask help for a proble with invalid syntax

2009-10-13 Thread leo zhao
I try to a run a python numpy programe, however the python can't run this program. my python version is 2.6.2 , numpy version is 1.3.0, however, the program can run in previous numpy version(1.2.0), who can help me to solve the problem, I will deeply appreciate! the program is below: import sy

ask a question about the module

2009-11-11 Thread leo zhao
when I run a program, it list the hint: Could not import module "Gnuplot" - it is not installed on your system. You need to install the Gnuplot.py package. \easyviz\gnuplot_.py(41) : Traceback (most recent call last): File "E:\study\python\commodity modle 10.23.py", line 3, in import mult

Using class attributes

2010-02-15 Thread Leo Breebaart
_body, etc.) I can of course always just hardcode the template filenames in each derived class, but I am just curious if it can be automated through some form of introspection. -- Leo Breebaart -- http://mail.python.org/mailman/listinfo/python-list

Re: Using class attributes

2010-02-16 Thread Leo Breebaart
Chris Rebert writes: > On Mon, Feb 15, 2010 at 10:29 AM, Leo Breebaart wrote: > > > I have a base class Foo with a number of derived classes FooA, > > FooB, FooC, etc. Each of these derived classes needs to read > > (upon initialisation) text from an associated tem

Re: Using class attributes

2010-02-18 Thread Leo Breebaart
x27;d doubt it). But it's certainly been educational to learn about these techniques. One observation: if I implement the descriptor solution as given above, the code works perfectly, but running the code through pychecker now causes an error, because that again causes an attempt to read from the non-existant base class template file "Foo.tmpl"... -- Leo Breebaart -- http://mail.python.org/mailman/listinfo/python-list

Re: Using class attributes

2010-02-18 Thread Leo Breebaart
evaluation and caching solution now -- I never really had a big problem with that. My thanks again to all of you for helping me out with this. -- Leo Breebaart -- http://mail.python.org/mailman/listinfo/python-list

How do you find out what's happening in a process?

2010-11-28 Thread Leo Jay
Hi all, I'd like to know how do you guys find out what's happening in your code if the process seems not work. In java, I will use jstack to check stacks of threads and lock status. But I don't know how to do it in python. -- Best Regards, Leo Jay -- http://mail.python.org/m

Re: Windows installer of Python

2010-04-14 Thread Leo Jay
gt; dont know how to catch them. >> > The files and subfolders of Python are all installed into a single > folder, for example C:\Python26, and none into the system folder or > other places, if you are worried about that. > I don't think so. At least, the pythonXX.d

Why the inconsistent of those two base64 methods?

2010-05-11 Thread Leo Jay
ult of 'aaa'.encode('base64') has a '\n' at the end, but the other method doesn't. Why the inconsistent? Thanks. -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list

What does this PyChecker warning mean?

2010-06-01 Thread Leo Breebaart
meant by this warning. In fact, it simply seems wrong -- but I have learned not to jump to that conclusion too quickly, so I was hoping someone here could perhaps enlighten me... Many thanks in advance, -- Leo Breebaart -- http://mail.python.org/mailman/listinfo/python-list

Re: What does this PyChecker warning mean?

2010-06-01 Thread Leo Breebaart
pylint on it before doing anything else, just to see what comes up. As far as I can tell the sole reason for that code being structured the way it is, is to provide a kind of module-within-a-module and not clutter up the outer module with these helper classes needed only by the foo() function. -- L

dynamically associate radio buttons with droplists

2009-06-19 Thread Leo Brugud
Hi Folks, Not being very familiar with python, nor with cgi/http, I intend to have 3 of buttons in a webpage, each of them is associate with a file (so I have 3 files, too) What I would like to have is, when users choose a button, the droplist update automatically to load the contents of the ass

<    1   2   3   >