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

2007-10-24 Thread Leo Kislov
On Oct 23, 3:37 am, kettle <[EMAIL PROTECTED]> wrote: > Hi, >   I am rather new to python, and am currently struggling with some > encoding issues.  I have some utf-8-encoded text which I need to > encode as iso-2022-jp before sending it out to the world. I am using > python's encode functions: > -

Re: Portable general timestamp format, not 2038-limited

2007-06-28 Thread Leo Kislov
On Jun 27, 10:51 pm, Paul Rubin wrote: > The difficulty/impossibility of computing intervals on UTC because of > leap seconds suggests TAI is a superior timestamp format. If you care about intervals you'd better keep timestamps in SI seconds since some zero time point (j

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: String formatting for complex writing systems

2007-06-27 Thread Leo Kislov
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 tables of text and > numbers.  When I test it in English, the columns are aligned nicely, > but when he tests it

Re: Method much slower than function?

2007-06-13 Thread Leo Kislov
On Jun 13, 5:40 pm, [EMAIL PROTECTED] wrote: > Hi all, > > I am running Python 2.5 on Feisty Ubuntu. I came across some code that > is substantially slower when in a method than in a function. > > >>> cProfile.run("bar.readgenome(open('cb_foo'))") > > 20004 function calls in 10.214 CPU sec

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: How to wrap a Japanese text in Python

2007-06-08 Thread Leo Kislov
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.decode("UTF8") >strlist = textwrap.wrap(message,54) > > After this I am wirting it to you a CAD Software window. While

Re: Python memory handling

2007-06-01 Thread Leo Kislov
On May 31, 8:06 am, [EMAIL PROTECTED] wrote: > Hello, > > I will try later with python 2.5 under linux, but as far as I can see, > it's the same problem under my windows python 2.5 > After reading this document > :http://evanjones.ca/memoryallocator/python-memory.pdf > > I think it's because list

Re: invoke user's standard mail client

2007-05-07 Thread Leo Kislov
On May 7, 2:00 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On May 7, 10:28 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > > > > > Get the pywin32 package (Python for Windows extensions) from sourceforge, > > install it, and look into the win32comext\mapi\demos directory. > > Thanks

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

2007-05-07 Thread Leo Kislov
On May 7, 4:15 pm, Irmen de Jong <[EMAIL PROTECTED]> wrote: > Martin v. Löwis wrote: > >> Is this a bug? > > > Why don't you read the responses posted earlier? John Machin > > replied (in <[EMAIL PROTECTED]>) > > that you are mistaken: There is NO difference between the outcome > > of os.path.getmt

Re: relative import broken?

2007-05-03 Thread Leo Kislov
On May 3, 10:08 am, "Alan Isaac" <[EMAIL PROTECTED]> wrote: > "Alex Martelli" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > Very simply, PEP 328 explains: > > """ > > Relative Imports and __name__ > > > Relative imports use a module's __name__ attribute to determine that > >

Re: My Python annoyances

2007-05-03 Thread Leo Kislov
On May 3, 9:27 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 03 May 2007 10:49:26 -0300, Ben Collver <[EMAIL PROTECTED]> > escribió: > > > I tried to write portable Python code. The zlib CRC function returned > > different results on architectures between 32 bit and 64 bit > >

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

2007-05-03 Thread Leo Kislov
On May 3, 2:54 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > >>> "import site failed" > >>> OverflowError: signed integer is greater than the maximum. > >> - what is the value of ival? > > ival: 4294967295 > > I see. This is 0x, which would be -1 if it were of type > int. So perhaps so

Re: Python's handling of unicode surrogates

2007-04-22 Thread Leo Kislov
On Apr 20, 7:34 pm, Rhamphoryncus <[EMAIL PROTECTED]> wrote: > On Apr 20, 6:21 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > If you absolutely think support for non-BMP characters is necessary > > in every program, suggesting that Python use UCS-4 by default on > > all systems has a higher c

Re: iterator interface for Queue?

2007-04-08 Thread Leo Kislov
On Apr 7, 11:40 pm, Paul Rubin wrote: > Is there any reason Queue shouldn't have an iterator interface? > I.e. instead of > > while True: >item = work_queue.get() >if item is quit_sentinel: ># put sentinel back so other readers can find it

Re: shutil.copy Problem

2007-04-01 Thread Leo Kislov
On Mar 28, 7:01 am, David Nicolson <[EMAIL PROTECTED]> wrote: > Hi John, > > That was an excellent idea and it was the cause problem. Whether this > is a bug inshutilI'm not sure. > > Here is the traceback, Python 2.4.3 on Windows XP: > > > > > > > C:\Documents and Settings\Güstav>C:\python243\py

Re: I18n issue with optik

2007-04-01 Thread Leo Kislov
On Apr 1, 8:47 am, Thorsten Kampe <[EMAIL PROTECTED]> wrote: > I guess the culprit is this snippet from optparse.py: > > # used by test suite > def _get_encoding(self, file): > encoding = getattr(file, "encoding", None) > if not encoding: > encoding = sys.getdefaultencoding() >

Re: shutil.copy Problem

2007-03-26 Thread Leo Kislov
On Mar 26, 8:10 pm, David Nicolson <[EMAIL PROTECTED]> wrote: > Hi, > > I wasn't exactly sure where to send this, I don't know if it is a bug > in Python or not. This is rare, but it has occurred a few times and > seems to be reproducible for those who experience it. > > Examine this code: > >

Re: Unicode zipping from Python code?

2007-03-26 Thread Leo Kislov
On Mar 26, 12:21 am, durumdara <[EMAIL PROTECTED]> wrote: > Hi! > > As I experienced in the year 2006, the Python's zip module is not > unicode-safe. I'd rather say unicode file names are not supported. Why? Because zip format didn't support unicode file names upto 2006. > With the hungarian file

Re: Making a non-root daemon process

2007-03-23 Thread Leo Kislov
On Mar 22, 11:19 pm, Ben Finney <[EMAIL PROTECTED]> wrote: > Howdy all, > > For making a Python program calve off an independent daemon process of > itself, I found Carl J. Schroeder's recipe in the ASPN Python Cookbook. > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731> > > This is

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: 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-15 Thread Leo Kislov
On Mar 15, 2:31 pm, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: [snip] > os.environ['__kabc_ldap'] = temp_file_name [snip] > Now as per the above code, "aa" is the first string which will be executed in > Thread-1. In my query to the ldap server, I am getting a record which matches > t

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

Re: urllib.unquote and unicode

2006-12-18 Thread Leo Kislov
George Sakkis wrote: > The following snippet results in different outcome for (at least) the > last three major releases: > > >>> import urllib > >>> urllib.unquote(u'%94') > > # Python 2.3.4 > u'%94' > > # Python 2.4.2 > UnicodeDecodeError: 'ascii' codec can't decode byte 0x94 in position 0: > or

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Leo Kislov
ronrsr wrote: > > > > > Try putting "use_unicode=True" in the MySQLdb "connect" call. > > tried that, and also added charset="utf8" - > > now, I can't do any string operations, I get the error msg: > > descriptor 'lower' requires a 'str' object but received a 'unicode' > args = ("descript

Re: writing serial port data to the gzip file

2006-12-17 Thread Leo Kislov
Petr Jakes wrote: > I am trying to save data it is comming from the serial port continually > for some period. > (expect reading from serial port is 100% not a problem) > Following is an example of the code I am trying to write. It works, but > it produce an empty gz file (0kB size) even I am sure

Re: Roundtrip SQL data especially datetime

2006-12-15 Thread Leo Kislov
John Nagle wrote: > Routinely converting MySQL DATETIME objects to Python "datetime" > objects isn't really appropriate, because the MySQL objects have a > year range from 1000 to , while Python only has the UNIX range > of 1970 to 2038. You're mistaken. Python datetime module excepts year

Re: Serial port failure

2006-12-15 Thread Leo Kislov
Rob wrote: > try: > response = p.readline() > except SerialException: > print ">Timed out<" > try: > port.writelines(msg) > except OSError: > print "Serial port failure. Power cycle units" > port.close()

Re: Serial port failure

2006-12-15 Thread Leo Kislov
Rob wrote: > Hi all, > > I am fairly new to python, but not programming and embedded. I am > having an issue which I believe is related to the hardware, triggered > by the software read I am doing in pySerial. I am sending a short > message to a group of embedded boxes daisy chained via the seri

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/listinfo/python-l

Re: inconvenient unicode conversion of non-string arguments

2006-12-13 Thread Leo Kislov
Holger Joukl wrote: > [EMAIL PROTECTED] schrieb am 13.12.2006 > 11:02:30: > > > > > Holger Joukl wrote: > > > Hi there, > > > > > > I consider the behaviour of unicode() inconvenient wrt to conversion of > > > non-string > > > arguments. > > > While you can do: > > > > > > >>> unicode(17.3) > > >

Re: inconvenient unicode conversion of non-string arguments

2006-12-13 Thread Leo Kislov
Holger Joukl wrote: > Hi there, > > I consider the behaviour of unicode() inconvenient wrt to conversion of > non-string > arguments. > While you can do: > > >>> unicode(17.3) > u'17.3' > > you cannot do: > > >>> unicode(17.3, 'ISO-8859-1', 'replace') > Traceback (most recent call last): > File

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

2006-12-13 Thread Leo Kislov
kernel1983 wrote: > and I tried unicode and utf-8 How did you try unicode? Like this? : EasyDialogs.Message(u'\u4e2d') > I tried to both use unicode&utf-8 head just like "\xEF\xBB\xBF" and not > to use > > Anyone knows about the setting in the python code file? > Maybe python doesn't know I'm t

Re: How to turn of the monitor by python?

2006-12-12 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > I want to turn off my monitor from within python, How to do it? > Thanks! Do you realize that hardware management and control is OS dependant? When asking such questions always specify OS. Assuming you are interested in Windows, then you just need to translate this

Re: sys.stdin.encoding

2006-12-11 Thread Leo Kislov
Martin v. Löwis wrote: > [EMAIL PROTECTED] schrieb: > > The following line in my code is failing because sys.stdin.encoding is > > Null. This has only started happening since I started working with > > Pydef in Eclipse SDK. Any ideas? > > > > uni=unicode(word,sys.stdin.encoding) > > That's a probl

Re: sys.stdin.encoding

2006-12-11 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Duncan Booth skrev: > > > [EMAIL PROTECTED] wrote: > > > > > The following line in my code is failing because sys.stdin.encoding is > > > Null. > > > > I'll guess you mean None rather than Null. > > > > > This has only started happening since I started working with > > >

Re: Printing Barcodes from webapp?

2006-12-02 Thread Leo Kislov
Burhan wrote: > Hello Group: > > I am in the planning stages of an application that will be accessed > over the web, and one of the ideas is to print a barcode that is > generated when the user creates a record. The application is to track > paperwork/items and uses barcodes to easily identify

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: Problem with imaplib (weird result if mailbox contains a %)

2006-11-28 Thread Leo Kislov
Antoon Pardon wrote: > This little program gives IMO a strange result. > > import imaplib > > user = "cpapen" > > cyr = imaplib.IMAP4("imap.vub.ac.be") > cyr.login("cyrus", "cOn-A1r") > rc, lst = cyr.list('""', "user/%s/*" % user) > for el in lst: > print "%r" % (el,) > > And the result is: > >

Re: Dynamic/runtime code introspection/compilation

2006-11-28 Thread Leo Kislov
Thomas W wrote: > Maybe a stupid subject, but this is what I want to do : > > I got some python code stored in a string: > > somecode = """ > > from somemodule import ISomeInterface > > class Foo(ISomeInterface): > param1 = ... > param2 = > > """ > > and I want to compile that code so

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Wow, I was in fact searching for this syntax in the python tutorial. It > is missing there. > Is there a reference page which documents all possible list > comprehensions. There is actually only two forms of list comprehensions: http://docs.python.org/ref/lists.html [bl

Re: os.walk return hex excapes

2006-11-28 Thread Leo Kislov
Alex S wrote: > Hi, > os.walk return hex excape sequence inside a files name, and when i try > to feed it back to os.remove i get > > OSError: [Errno 22] Invalid argument: > 'C:\\Temp\\?p?\xbfS\xbf\xac?G\xaba ACDSee \xbb?a??n a???\xac\xb5\xbfn.exe' It's not escape sequences that are the problem bu

Re: Modifying every alternate element of a sequence

2006-11-28 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > I have a list of numbers and I want to build another list with every > second element multiplied by -1. > > input = [1,2,3,4,5,6] > wanted = [1,-2,3,-4,5,-6] > > I can implement it like this: > > input = range(3,12) > wanted = [] > for (i,v) in enumerate(input): > if

Re: How to increase the speed of this program?

2006-11-28 Thread Leo Kislov
HYRY wrote: > Peter Otten wrote: > > HYRY wrote: > > > > > I want to join two mono wave file to a stereo wave file by only using > > > the default python module. > > > Here is my program, but it is much slower than the C version, so how > > > can I increase the speed? > > > I think the problem is a

Re: How to increase the speed of this program?

2006-11-28 Thread Leo Kislov
Peter Otten wrote: > Peter Otten wrote: > > > HYRY wrote: > > > >> I want to join two mono wave file to a stereo wave file by only using > >> the default python module. > >> Here is my program, but it is much slower than the C version, so how > >> can I increase the speed? > >> I think the problem

Re: Email headers and non-ASCII characters

2006-11-24 Thread Leo Kislov
Christoph Haas wrote: > Hello, everyone... > > I'm trying to send an email to people with non-ASCII characters in their > names. A recpient's address may look like: > > "Jörg Nørgens" <[EMAIL PROTECTED]> > > My example code: > > = > def sendmail(sender, recipient, b

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: A python IDE for teaching that supports cyrillic i/o

2006-11-19 Thread Leo Kislov
Kirill Simonov wrote: > Hi, > > Could anyone suggest me a simple IDE suitable for teaching Python as a > first programming language to high school students? It is necessary > that it has a good support for input/output in Cyrillic. > > Unfortunately, most IDEs I tried failed miserably in this resp

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-18 Thread Leo Kislov
Martin v. Löwis wrote: > Leo Kislov schrieb: > > How about returning two lists, first list contains unicode names, the > > second list contains undecodable names: > > > > files, troublesome = os.listdir(separate_errors=True) > > > > and make separate_errors=T

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Leo Kislov
gabor wrote: > Martin v. Löwis wrote: > > gabor schrieb: > >> i also recommend this approach. > >> > >> also, raising an exception goes well with the principle of the least > >> surprise imho. > > > > Are you saying you wouldn't have been surprised if that had been > > the behavior? > > > yes, i w

Re: os.lisdir, gets unicode, returns unicode... USUALLY?!?!?

2006-11-17 Thread Leo Kislov
Martin v. Löwis wrote: > gabor schrieb: > >> All this code will typically work just fine with the current behavior, > >> so people typically don't see any problem. > >> > > > > i am sorry, but it will not work. actually this is exactly what i did, > > and it did not work. it dies in the os.path.jo

Re: how to print pdf with python on a inkjet printer.

2006-11-17 Thread Leo Kislov
Leo Kislov wrote: > CUPS only have command line interface: > <http://www.cups.org/documentation.php/options.html> My mistake: CUPS actually has official C API <http://www.cups.org/documentation.php/api-cups.html> and unofficial python bindings <http://freshmeat.net/project

Re: how to print pdf with python on a inkjet printer.

2006-11-17 Thread Leo Kislov
krishnakant Mane wrote: > hello all. > I am developing an ncurses based python application that will require > to create pdf reports for printing. > I am not using py--qt or wx python. > it is a consol based ui application and I need to make a pdf report > and also send it to a lazer or ink jet pr

Re: Problem reading with bz2.BZ2File(). Bug?

2006-11-15 Thread Leo Kislov
Clodoaldo Pinto Neto wrote: > Fredrik Lundh wrote: > > Clodoaldo Pinto Neto wrote: > > > > > The offending file is 5.5 MB. Sorry, i could not reproduce this problem > > > with a smaller file. > > > > but surely you can post the repr() of the last two lines? > > This is the output: > > $ python bzp.

Re: Character Encodings and display of strings

2006-11-13 Thread Leo Kislov
JKPeck wrote: > It seemed to me that this sentence > > For many types, this function makes an attempt to return a string that > would yield an object with the same value when passed to eval(). > > might mean that the encoding setting of the source file might influence > how repr represented the co

Re: str.title question after '

2006-11-13 Thread Leo Kislov
Antoon Pardon wrote: > I have a text in ascii. I use the ' for an apostroph. The problem is > this gives problems with the title method. I don't want letters > after a ' to be uppercased. Here are some examples: > >argument result expected > > 't smidje 'T Smidje

Re: comparing Unicode and string

2006-11-10 Thread Leo Kislov
Neil Cerutti wrote: > On 2006-11-10, Steve Holden <[EMAIL PROTECTED]> wrote: > >>> But I don't insist on my PEP. The example just shows just > >>> another pitfall with Unicode and why I'll advise to any > >>> beginner: Never write text constants that contain non-ascii > >>> chars as simple strings,

Re: Erronous "unsupported locale setting" ?

2006-11-06 Thread Leo Kislov
robert wrote: > Leo Kislov wrote: > > robert wrote: > >> Why can the default locale not be set by its true name? but only by '' ? : > > > > Probably it is just not implemented. But since locale names are system > > specific (For example windows accept

Re: Erronous "unsupported locale setting" ?

2006-11-06 Thread Leo Kislov
robert wrote: > Why can the default locale not be set by its true name? but only by '' ? : Probably it is just not implemented. But since locale names are system specific (For example windows accepts 'ch' as Chinese in Taiwan, where as IANA

Re: How to test python extension modules during 'make check' / 'make distcheck'?

2006-11-02 Thread Leo Kislov
Mark Asbach wrote: > Hi pythonians, > > I'm one of the maintainers of an open source image processing toolkit > (OpenCV) and responsible for parts of the autotools setup. The package > mainly consists of four shared libraries but is accompanied by a python > package containing some pure python cod

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Leo Kislov
Sachin Punjabi wrote: > I installed it again but it makes no difference. It still throws me > error for LookUp Error: unknown encoding : utf-8. Most likely you're not using the new python, you're still running old one. -- Leo -- http://mail.python.org/mailman/listinfo/python-list

Re: Lookuperror : unknown encoding : utf-8

2006-10-30 Thread Leo Kislov
Sachin Punjabi wrote: > On Oct 30, 1:29 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > Sachin Punjabi wrote: > > > The OS is Windows XPthen your installation is seriously broken. where > > > did you get the > > installation kit? have you removed stuff from the Lib directory ? > > > > > > It

Re: Lookuperror : unknown encoding : utf-8

2006-10-29 Thread Leo Kislov
Sachin Punjabi wrote: > Hi, > > I wanted to read a file encoded in utf-8 and and using the following > syntax in my source which throws me an error specifying Lookuperror : > unknown encoding : utf-8. Also I am working on Python version 2.4.1. > > import codecs > fileObj = codecs.open( "data.txt",

Re: subprocess decoding?

2006-10-29 Thread Leo Kislov
MC wrote: > Hi! > > On win-XP (french), when I read subprocess (stdout), I must use > differents decoding (cp1252,cp850,cp437, or no decoding), depending of > the "launch mode" of the same Python's script: > - from command-line > - from start+run > - from icon > - by Python-COM-server >

Re: gettext on Windows

2006-10-28 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Martin v. Löwis wrote: > > [EMAIL PROTECTED] schrieb: > > > Traceback (most recent call last): > > > File "panicbutton.py", line 36, in ? > > > lan = gettext.GNUTranslations (open (sLang, "rb")) > > > File "C:\Python24\lib\gettext.py", line 177, in __init__ > > >

Re: subprocess cwd keyword.

2006-10-26 Thread Leo Kislov
Ivan Vinogradov wrote: > Dear All, > > I would greatly appreciate a nudge in the right direction concerning > the use of cwd argument in the call function from subprocess module. > > The setup is as follows: > > driver.py <- python script > core/ <- directory >

Re: my first software

2006-10-26 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > I am a beginner of programming and started to learn Python a week ago. > last 3 days, i write this little tool for Renju.if you have any advice > on my code,please tell me > s = '' > > for i in range (0,len(done) - 1): > s = s +str(done[i][0]) + str(done

Re: How to identify generator/iterator objects?

2006-10-25 Thread Leo Kislov
Michael Spencer wrote: > Kenneth McDonald wrote: > > I'm trying to write a 'flatten' generator which, when give a > > generator/iterator that can yield iterators, generators, and other data > > types, will 'flatten' everything so that it in turns yields stuff by > > simply yielding the instances o

Re: How to identify generator/iterator objects?

2006-10-25 Thread Leo Kislov
Kenneth McDonald wrote: > I'm trying to write a 'flatten' generator which, when give a > generator/iterator that can yield iterators, generators, and other data > types, will 'flatten' everything so that it in turns yields stuff by > simply yielding the instances of other types, and recursively yi

Re: encoding of sys.argv ?

2006-10-23 Thread Leo Kislov
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Jiba wrote: > > > I am desperately searching for the encoding of sys.argv. > > > > I use a Linux box, with French UTF-8 locales and an UTF-8 filesystem. > > sys.getdefaultencoding() is "ascii" and sys.getfilesystemencoding() is > > "utf-8".

Re: encoding of sys.argv ?

2006-10-23 Thread Leo Kislov
Jiba wrote: > Hi all, > > I am desperately searching for the encoding of sys.argv. > > I use a Linux box, with French UTF-8 locales and an UTF-8 filesystem. > sys.getdefaultencoding() is "ascii" and sys.getfilesystemencoding() is > "utf-8". However, sys.argv is neither in ASCII (since I can pass

Re: right curly quote and unicode

2006-10-20 Thread Leo Kislov
On 10/19/06, TiNo <[EMAIL PROTECTED]> wrote: > Now I know where the problem lies. The character in the actual file path is > u+00B4 (Acute accent) and in the Itunes library it is u+2019 (a right curly > quote). Somehow Itunes manages to make these two the same...? > > As it is the only file that ga

Re: comparing Unicode and string

2006-10-20 Thread Leo Kislov
[EMAIL PROTECTED] wrote: > Thanks, John and Neil, for your explanations. > > Still I find it rather difficult to explain to a Python beginner why > this error occurs. > > Suggestion: shouldn't an error raise already when I try to assign s2? A > normal string should never be allowed to contain char

Re: Flexible Collating (feedback please)

2006-10-20 Thread Leo Kislov
Ron Adam wrote: > Leo Kislov wrote: > > Ron Adam wrote: > > > >> locale.setlocale(locale.LC_ALL, '') # use current locale settings > > > > It's not current locale settings, it's user's locale settings. > > Application can actual

Re: Type discrepancy using struct.unpack

2006-10-19 Thread Leo Kislov
Pieter Rautenbach wrote: > Hallo, > > I have a 64 bit server with CentOS 4.3 installed, running Python. > > [EMAIL PROTECTED] pymsnt-0.11.2]$ uname -a > Linux lutetium.mxit.co.za 2.6.9-34.ELsmp #1 SMP Thu Mar 9 06:23:23 GMT > 2006 x86_64 x86_64 x86_64 GNU/Linux > > Consider the following two snipp

Re: Flexible Collating (feedback please)

2006-10-19 Thread Leo Kislov
Ron Adam wrote: > locale.setlocale(locale.LC_ALL, '') # use current locale settings It's not current locale settings, it's user's locale settings. Application can actually use something else and you will overwrite that. You can also affect (unexpectedly to the application) time.strftime() and C

Re: codecs.EncodedFile

2006-10-18 Thread Leo Kislov
Neil Cerutti wrote: > It turns out to be troublesome for my case because the > EncodedFile object translates calls to readline into calls to > read. > > I believe it ought to raise a NotImplemented exception when > readline is called. > > As it is it silently causes interactive applications to >

Re: characters in python

2006-10-18 Thread Leo Kislov
Leo Kislov wrote using google groups beta: > On Oct 18, 11:50 am, Stens <[EMAIL PROTECTED]> wrote: > > Stens wrote: > > > Can python handle this characters: c,c,ž,d,š? [snip] > outfile.write(line.replace(u'd',u'd')) I hope you'l

Re: characters in python

2006-10-18 Thread Leo Kislov
On Oct 18, 11:50 am, Stens <[EMAIL PROTECTED]> wrote: > Stens wrote: > > Can python handle this characters: c,c,ž,d,š? > > > If can how"I wanna to change some characters in text (in the file) to the > characters at this address: > > http://rapidshare.de/files/37244252/Untitled-1_copy.png.html Yo

Re: right curly quote and unicode

2006-10-18 Thread Leo Kislov
On 10/17/06, TiNo <[EMAIL PROTECTED]> wrote: > Hi all, > > I am trying to compare my Itunes Library xml to the actual files on my > computer. > As the xml file is in UTF-8 encoding, I decided to do the comparison of the > filenames in that encoding. > It all works, except with one file. It is named

Re: Alphabetical sorts

2006-10-16 Thread Leo Kislov
On Oct 16, 2:39 pm, Tuomas <[EMAIL PROTECTED]> wrote: > My application needs to handle different language sorts. Do you know a > way to apply strxfrm dynamically i.e. without setting the locale? Collation is almost always locale dependant. So you have to set locale. One day I needed collation th

Re: How to send E-mail without an external SMTP server ?

2006-10-16 Thread Leo Kislov
On Oct 16, 2:04 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > It's not safe if I have to use login method explicitly by which I have > to put my username and password in the script. I have also tried the > Unix command 'mail', but without success, either. I could use 'mail' to > send an E-

Re: How to send E-mail without an external SMTP server ?

2006-10-16 Thread Leo Kislov
On Oct 16, 12:31 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Rob Wolfe wrote: > > [EMAIL PROTECTED] wrote: > > >> Hi, > > >> I just want to send a very simple email from within python. > > >> I think the standard module of smtpd in python can do this, but I > >> haven't found documents a

Re: How to send E-mail without an external SMTP server ?

2006-10-16 Thread Leo Kislov
On Oct 15, 10:25 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > > I just want to send a very simple email from within python. > > I think the standard module of smtpd in python can do this, but I > haven't found documents about how to use it after googleing. Are there > any examples o

Re: Need a Regular expression to remove a char for Unicode text

2006-10-13 Thread Leo Kislov
On Oct 13, 4:55 am, "Leo Kislov" <[EMAIL PROTECTED]> wrote: > On Oct 13, 4:44 am, [EMAIL PROTECTED] wrote: > > > శ్రీనివాస wrote: > > > Hai friends, > > > Can any one tell me how can i remove a character from a unocode text. > > > కల్‌&హ

Re: Need a Regular expression to remove a char for Unicode text

2006-10-13 Thread Leo Kislov
On Oct 13, 4:44 am, [EMAIL PROTECTED] wrote: > శ్రీనివాస wrote: > > Hai friends, > > Can any one tell me how can i remove a character from a unocode text. > > కల్‌&హార is a Telugu word in Unicode. Here i want to > > remove '&' but not replace with a zero width char. And one more thing, > > if any

Re: How to find number of characters in a unicode string?

2006-10-10 Thread Leo Kislov
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Marc 'BlackJack' > Rintsch wrote: > > > In <[EMAIL PROTECTED]>, > > Preben Randhol wrote: > > > >> Is there a way to calculate in characters > >> and not in bytes to represent the characters. > > > > Decode the byte string and use `len()

Re: People's names (was Re: sqlite3 error)

2006-10-10 Thread Leo Kislov
John J. Lee wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > [...] > > > There would also need to be a flag field to indicate the canonical > > > ordering > > > for writing out the full name: e.g. family-name-first, given-names-first. > > > Do we need something else for the Vietnamese case? > >

Re: does raw_input() return unicode?

2006-10-10 Thread Leo Kislov
Duncan Booth wrote: > "Stuart McGraw" <[EMAIL PROTECTED]> wrote: > > > So, does raw_input() ever return unicode objects and if > > so, under what conditions? > > > It returns unicode if reading from sys.stdin returns unicode. > > Unfortunately, I can't tell you how to make sys.stdin return unicode

Re: does raw_input() return unicode?

2006-10-10 Thread Leo Kislov
Theerasak Photha wrote: > On 10/10/06, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > > Theerasak Photha schrieb: > > >> At the moment, it only returns unicode objects when invoked > > >> in the IDLE shell, and only if the character entered cannot > > >> be represented in the locale's charset. > >