Re: List objects are un-hashable

2007-04-27 Thread Ganesan Rajagopal
>>>>> "Andy" == Andy <[EMAIL PROTECTED]> writes: > if keyword.iskeyword(tempwords): > print tempwords for word in tempwords: if keyword.iskeyword(word): print word Ganesan -- Ganesan Rajagopal -- http://ma

Re: Python Feature Request: Explicit variable declarations

2007-04-14 Thread Ganesan Rajagopal
suggested for the actual declarations of local variables, > and no discussion whether this is meant to apply to local variables > only, or also to global variables and object attributes. None of the above links talk about variable declarations but object attributes are considered. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: Pexpect: SSH, Command and Password

2007-04-04 Thread Ganesan Rajagopal
self.child.logfile = sys.stdout That should give you some clue. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert to binary and convert back to strings

2007-02-21 Thread Ganesan Rajagopal
the requirement. If the intention is to just to discourage someone with messing around with some config settings, it's good enough. If the user can figure out that it's base64 encoded and takes pains to decode, modify, encode and save it back, then he's earned the right to mess around

Re: Convert to binary and convert back to strings

2007-02-21 Thread Ganesan Rajagopal
fuscate the string. How about this? import base64 text = 'supercalifragilisticexpialidocius' open('sambleb.conf', 'w').write(base64.encodestring(text)) print base64.decodestring(open('sambleb.conf', 'r').read()) Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: problems loading modules

2007-02-04 Thread Ganesan Rajagopal
27;module' object has no attribute 'randrange' >>>> > Here it does not work. Here's a clue. == >>> import numpy >>> numpy.random === Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: maximum number of threads

2007-01-12 Thread Ganesan Rajagopal
hreads stack size is 8MB. Linux user space is 3GB (Kernel is mapped at upper 1GB). 382 * 8 = 3056MB. Basically, you're running out of address space. I don't know if you have any control at python level. In C you can call pthread_attr_setstacksize(). Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: Programmatically finding "significant" data points

2006-11-14 Thread Ganesan Rajagopal
fter. He's seems to be looking for points when the direction changes. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: pexpect baudrate and mode settings

2006-09-21 Thread Ganesan Rajagopal
Linux to set these parameters before you use pexpect. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: mobile phone app

2006-09-08 Thread Ganesan Rajagopal
, but in some restricted cases, yes. See http://forum.nokia.com/python -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: Memory usage of an 'empty' python interpreter

2006-08-16 Thread Ganesan Rajagopal
n binary. In your case it's obvious that the python binary is linking to a shared python library. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple file writing techiques ...

2006-07-19 Thread Ganesan Rajagopal
labitiy, what if > the file was huge, like some sort of log file. Considering that you've already read in the whole file into a list, it's too late to worry about scalability when writing out :-). Have you considered the fileinput module? Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: ctypes wrapping libpam.so on FreeBSD 6.1 - Python Bus Error

2006-07-13 Thread Ganesan Rajagopal
>const struct pam_conv *pam_conv, pam_handle_t **pamh) Note that pam_conv is a structure. Passing a string 'PAM_PROMPT_ECHO_ON' and not passing a pointer for getting the pam_handle_t are both candidates to cause a crash. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: don't need dictionary's keys - hash table?

2006-07-12 Thread Ganesan Rajagopal
umber. It's sufficient to do while d.has_key(key): key += 1 > I am a little surprised that hash(hash(s)) == hash(s), is that actually > true? >>> hash(42) 42 Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: How to terminate a main script?

2006-07-11 Thread Ganesan Rajagopal
>>>>> Helmut Jarausch <[EMAIL PROTECTED]> writes: > Using sys.exit(0) produces an error message which looks dangerous to an > uninitiated user. What message? Your program should exit silently when you call sys.exit(0). Ganesan -- Ganesan Rajagopal -- http://mail.

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
elif i == 2:print 2 > elif i == 3:print 3 You don't need the second pattern, the first pattern will catch the second case also. You also need to break when i == 2 or i == 3. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
plete. Put the body of the "try:" in a while loop. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
useful fro debugging > import pexpect > cmd = '/usr/bin/rsync config [EMAIL PROTECTED]:/tmp/.' > #cmd = 'ssh [EMAIL PROTECTED]' > child = pexpect.spawn(cmd) Add "child.logfile = sys.stdout" here and check what's going on. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: popen and password entry

2006-06-14 Thread Ganesan Rajagopal
>>>>> sinan nalkaya <[EMAIL PROTECTED]> writes: > i want to use rsync for remote file transfer via popen, but couldnt pass > the Password yet. For interactive input try the pexpect module instead of popen (see http://pexpect.sf.net). Ganesan -- Ganesan Rajagopal

Re: Python 411.

2006-06-13 Thread Ganesan Rajagopal
the US. The site is a directory of URLs. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: memory error with zipfile module

2006-05-19 Thread Ganesan Rajagopal
file is huge. Even if it's only a CD image (approx 650MB), reading it all into memory in a single string is not a good idea. > The python zipfile module is obviously broken... Indeed. I am surprised that there is no API that returns a file object. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: pysqlite problem

2006-03-01 Thread Ganesan Rajagopal
only if you create the table after the connect. Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan| http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: About undisclosed recipient

2006-02-13 Thread Ganesan Rajagopal
>>>>> Liyana Robert <[EMAIL PROTECTED]> writes: > Pls help me to know About undisclosed recipient. > How we can sent mails to other like this. Use Bcc header instead of To or Cc. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: C regex equiv to Python implementation?

2006-01-06 Thread Ganesan Rajagopal
sting C app. What platform? Linux includes a regex(7) implementation in the C library. However, it doesn't support many of the extensions that Python regexes support. Try http://www.pcre.org/. There are pre-build binaries for Windows also. Ganesan -- Ganesan Rajagopal (rganesan

Re: [OT] How can I change Debian's default Python version?

2006-01-04 Thread Ganesan Rajagopal
the default debian python. You have two alternatives: 1. Compile the python packages manually. 2. Debian already has python 2.4. Install python2.4 using synaptic. Also install any required python2.4-* packages. You will need a symlink to make sure you get python2.4 by default. Ganesan

Re: Regex anomaly

2006-01-02 Thread Ganesan Rajagopal
>>>>> mike klaas <[EMAIL PROTECTED]> writes: > Thanks guys, that is probably the most ridiculous mistake I've made in > years I was taken too :-). This is quite embarassing, considering that I remember reading a big thread in python devel list about this a w

Re: Regex anomaly

2006-01-02 Thread Ganesan Rajagopal
oduce this on Debian Linux testing, both python 2.3 and python 2.4. Seems like a bug. search() also exhibits the same behavior. Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan| http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: how to convert string like '\u5927' to unicode string u'\u5927'

2005-12-27 Thread Ganesan Rajagopal
>>>>> "Fredrik" == Fredrik Lundh <[EMAIL PROTECTED]> writes: > Ganesan Rajagopal wrote: >>> unicodeStrFromNetwork = '\u5927' >>> unicodeStrNative = _unicodeRe(unisub, unicodeStrFromNetwork) >> >> How about unicodeStr

Re: how to convert string like '\u5927' to unicode string u'\u5927'

2005-12-27 Thread Ganesan Rajagopal
t; unicodeStrNative = _unicodeRe(unisub, unicodeStrFromNetwork) How about unicodeStrNative = eval("u'%s'" % (unicodeStrFromNetwork,)) Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan| http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Ganesan Rajagopal
>>>>> Alex Martelli <[EMAIL PROTECTED]> writes: > Ordered *by order of key insertion*: Java, PHP > Ordered *by other criteria*: LISP, C++ Java supports both ordered by key insertion (LinkedHashMap) as well as ordered by key comparison (TreeMap). Ganesan -- Gan

Re: Why are there no ordered dictionaries?

2005-11-22 Thread Ganesan Rajagopal
order. Java calls this a SortedMap. See http://java.sun.com/j2se/1.4.2/docs/api/java/util/SortedMap.html C++ STL map container is also a Sorted Associative container. See http://www.sgi.com/tech/stl/Map.html Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA We

Re: Hi, from my login i want to login as a other user ,

2005-11-10 Thread Ganesan Rajagopal
script as the new user? Or do you want to run other commands as teh new user? In any case, take a look at pexpect (http://pexpect.sourceforge.net) and see if it fits your purpose. Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rgane

Re: Flat file, Python accessible database?

2005-11-02 Thread Ganesan Rajagopal
gadfly (http://gadfly.sourceforge.net/gadfly.html) or KirbyBase (http://www.netpromi.com/kirbybase.html) but they are also separate packages to install. I would personally stick with SQLite. Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan| http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: hello, I want to change n bytes of a binary file

2005-11-02 Thread Ganesan Rajagopal
b = b.tostring() > or > b = "".join([chr(ord(c) ^ 255) for c in a]) I wish python would soon get a byte array type. For now I find numarray to be very convenient to do stuff like this. import numarray b = (numarray.array(a, type = 'u1') ^ 255).tostring() It&#x

Re: popen4

2005-10-18 Thread Ganesan Rajagopal
>>>>> "billie" == billie <[EMAIL PROTECTED]> writes: > Piet van Oostrum wrote: >> I think you need something like pyexpect for this. > PyExpect seems to be no more mantained. Try pexpect instead. http://pexpect.sourceforce.net/ Ganesan -- Ganesan R

Re: C#3.0 and lambdas

2005-09-23 Thread Ganesan Rajagopal
ussions on libraries in python-dev. Is there some other list with more discussions on libraries? Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan| http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: C#3.0 and lambdas

2005-09-23 Thread Ganesan Rajagopal
o see the DB API move forward, and experimental new innovations like static typing (with automatic type inferencing), stackless python etc. If the experiments don't survive, fine. It's still better than quibbling over minor syntactic detail. Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan| http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: pexpect question....

2005-07-02 Thread Ganesan Rajagopal
on't care about the child process > anymore. I would effectively want to "detach" from it. How about just calling close(), i.e. without wait=1? No need to spawn a new thread. Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-02 Thread Ganesan Rajagopal
>>>>> "darren" == darren kirby <[EMAIL PROTECTED]> writes: > quoth the Ganesan Rajagopal: >> I am stuck on level 3. I've tried every re that I can think of. Some body >> give me a clue. >> >> Ganesan >> >> -- >> G

Re: Python Challenge ahead [NEW] for riddle lovers

2005-05-02 Thread Ganesan Rajagopal
I am stuck on level 3. I've tried every re that I can think of. Some body give me a clue. Ganesan -- Ganesan Rajagopal -- http://mail.python.org/mailman/listinfo/python-list

Re: Why Python does *SLICING* the way it does??

2005-04-19 Thread Ganesan Rajagopal
ww.everything2.com/index.pl?node_id=1409551 Ganesan -- Ganesan Rajagopal (rganesan at debian.org) | GPG Key: 1024D/5D8C12EA Web: http://employees.org/~rganesan| http://rganesan.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list