ctype question

2009-06-04 Thread Amit Gupta
Hi, I have been using ctype.cdll to load a library, but I am unable to figure out how to load multiple libraries that depends on each other. E.g. I have two libraries A.so and B.so. A.so has some undefined references, and those symbols are defined in B.so. When I try to load

would this be called bug?

2008-05-23 Thread Amit Gupta
The code is attached below. Basically I am taking a substring of variable m, and using buffer instead of slicing. However, the application of int on that buffer start correctly from the offset, but it scans all the way to the end, instead of stopping at the length of the buffer. It works

python scripts to standalone executable

2008-03-31 Thread Amit Gupta
Hi I am looking for a some tool that can convert python scripts to executable on Linux. I found freeeze.py as the only option so far. Couple of queries on freeze: 1. Have anyone used the freeze utility and any experiences to share from that? 2. Is there any enterprise-level exe-builder for

Re: Newbie Question - Overloading ==

2008-03-31 Thread Amit Gupta
On Mar 31, 10:23 am, xkenneth [EMAIL PROTECTED] wrote: class A: def __eq__(self,other): return self.a == other.a and self.b == other.b class B: def __eq__(self,other): return self.a == other.a and self.c == other.c Thanks! Regards, Kenneth Miller Can't say

Re: python scripts to standalone executable

2008-03-31 Thread Amit Gupta
On Mar 31, 10:37 am, John Henry [EMAIL PROTECTED] wrote: On Mar 31, 10:24 am, Amit Gupta [EMAIL PROTECTED] wrote: Hi I am looking for a some tool that can convert python scripts to executable on Linux. I found freeeze.py as the only option so far. Couple of queries on freeze: 1

Re: python scripts to standalone executable

2008-03-31 Thread Amit Gupta
On Mar 31, 11:45 am, John Henry [EMAIL PROTECTED] wrote: Not sure. I use it on windows. I haven't looked at pyinstall.. Is it for linux? It appears so - according tohttp://www.pyinstaller.org/ Thanks! It does show support for Linux. The documentation says it works for python until version

Re: Newbie Question - Overloading ==

2008-03-31 Thread Amit Gupta
On Mar 31, 11:00 am, xkenneth [EMAIL PROTECTED] wrote: Yeah, this is what I'm talking about: def __eq__(self, other) : try : return except AttributeError: return False That seems a bit nasty to me. One thing about python (IMO); you can't just say this doesn't look

Re: python scripts to standalone executable

2008-03-31 Thread Amit Gupta
On Mar 31, 1:52 pm, Mike Driscoll [EMAIL PROTECTED] wrote: What about creating a setup.py and using the distutils command to build rpms or tarballs? http://docs.python.org/dist/built-dist.html Mike My quick look: The link you sent is under the header Distributing Python Modules. In my

Re: unitests don't run under pdb

2008-03-14 Thread Amit Gupta
On Feb 20, 8:51 pm, Miki [EMAIL PROTECTED] wrote: Hello Amit, python testname.py : the unitests runs as usual and I get the following results: -- Ran 2 tests in 0.024s OK

Re: packing things back to regular expression

2008-02-24 Thread Amit Gupta
CL(?Pname1[a-z]+)XY(?:AB)[aeiou]+(?Pname2CD(?Pname3..)\?EF) Good luck. -- Steven This is what I did in the end (in principle). Thanks. A -- http://mail.python.org/mailman/listinfo/python-list

packing things back to regular expression

2008-02-20 Thread Amit Gupta
Hi I wonder if python has a function to pack things back into regexp, that has group names. e.g: exp = (?Pname1[a-z]+) compiledexp = re.compile(exp) Now, I have a dictionary mytable = {a : myname} Is there a way in re module, or elsewhere, where I can have it match the contents from dictionary

Re: packing things back to regular expression

2008-02-20 Thread Amit Gupta
Before I read the message: I screwed up. Let me write again x = re.compile(CL(?Pname1[a-z]+)) # group name name1 is attached to the match of lowercase string of alphabet # Now I have a dictionary saying {name1, iamgood} # I would like a function, that takes x and my dictionary and return

unitests don't run under pdb

2008-02-20 Thread Amit Gupta
Hi I have a unitest file: If I do python testname.py : the unitests runs as usual and I get the following results: -- Ran 2 tests in 0.024s OK However, if I

seperate directory for .pyc files

2008-02-15 Thread Amit Gupta
Python'ites Is there an environment variable or some settings, that python can use to know the directory name for dumping .pyc files. Not a hard-requirement, I just don't like pyc files alongwith py files in my work area. Thanks A -- http://mail.python.org/mailman/listinfo/python-list

Re: re question

2008-02-07 Thread Amit Gupta
On Feb 7, 10:38 am, Amit Gupta [EMAIL PROTECTED] wrote: Python'ites I searched around google to find the answer to this question, but I can't: I have a named regexp : x = re.compile((?Pme[a-z]+)) What I want is an iterator, that can return me both the groupname and the matched string

re question

2008-02-07 Thread Amit Gupta
Python'ites I searched around google to find the answer to this question, but I can't: I have a named regexp : x = re.compile((?Pme[a-z]+)) What I want is an iterator, that can return me both the groupname and the matched string, e.g: m = x.search(aa) Somehow, I want to get {me : aa}, either

Re: getting all user defined attributes of a class

2008-02-07 Thread Amit Gupta
On Feb 7, 12:28 am, grflanagan [EMAIL PROTECTED] wrote: On Feb 6, 11:07 pm, Amit Gupta [EMAIL PROTECTED] wrote: Hi How do I get user defined attributes of a class? e.g Class A(object) : self.x = 1 -- I want something like: for userattrib

getting all user defined attributes of a class

2008-02-06 Thread Amit Gupta
Hi How do I get user defined attributes of a class? e.g Class A(object) : self.x = 1 -- I want something like: for userattrib in A.getAllUserAttribute() : print userattrib My question is, is there a builtin function, called getAllUserAttributes? Thanks --

Re: getting all user defined attributes of a class

2008-02-06 Thread Amit Gupta
On Feb 6, 2:15 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 06 Feb 2008 14:07:23 -0800, Amit Gupta wrote: Class A(object) : self.x = 1 This is not valid Python code. I want something like: for userattrib in A.getAllUserAttribute() : print userattrib My

Re: getting all user defined attributes of a class

2008-02-06 Thread Amit Gupta
On Feb 6, 2:55 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: Amit Gupta schrieb: On Feb 6, 2:15 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Wed, 06 Feb 2008 14:07:23 -0800, Amit Gupta wrote: Class A(object) : self.x = 1 This is not valid Python code. I want

loading dictionary from a file

2008-02-06 Thread Amit Gupta
Need a python trick, if it exists: I have a file that stores key, value in following format -- v1 : k1, v2 : k2 -- Is there a way to directly load this file as dictionary in python. I could do (foreach line in file, split by : and then do dictionary insert). Wondering, if some python built-in

Re: loading dictionary from a file

2008-02-06 Thread Amit Gupta
On Feb 6, 5:33 pm, Ben Finney [EMAIL PROTECTED] wrote: Amit Gupta [EMAIL PROTECTED] writes: Need a python trick, if it exists: I have a file that stores key, value in following format -- v1 : k1, v2 : k2 -- Is there a way to directly load this file as dictionary in python

Re: using pdb and catching exception

2007-12-03 Thread Amit Gupta
On Dec 1, 11:14 pm, Frank Millman [EMAIL PROTECTED] wrote: See this post from less than a week ago. http://tinyurl.com/2zyr7u I think that the message from Diez B. Roggisch has what you are looking for. Frank Millman Thanks Frank. But again, this results into stack-track when the

Re: using pdb and catching exception

2007-12-03 Thread Amit Gupta
On Dec 3, 11:10 am, Amit Gupta [EMAIL PROTECTED] wrote: Thanks Frank. But again, this results into stack-track when the exception is caught. On the other hand, I would like the debug-trace just before throwing the exception. As a case, I might be debugging code, where the programmar forgot

using pdb and catching exception

2007-12-01 Thread Amit Gupta
Py'ites I am using pdb to check my code, and I would like to put a statement like equivalent of C++gdbcatch throw. Basically, I would like debugger to start as soon as an exception is thrown. How may I do it? Thanks -- http://mail.python.org/mailman/listinfo/python-list