Help on Swig

2005-08-05 Thread Gurpreet Sachdeva
Hi, I am facing a problem with swig while using Pointers: Array.c #includestdio.h void Array(int *ptr) { int i; for (i = 0; i 6; i++) { printf(Index: %d - %d\n,i, *(ptr + i)); } } Array.i %module Array %{ extern void Array(int *ptr); #includestdio.h %} extern void

Operator Overloading

2005-08-01 Thread Gurpreet Sachdeva
Hi, Is there any provision in python which allows me to make my own operators? My problem is that I need to combine two dictonaries with their keys and I don't want to use any of the existing operators like '+','-','*'. So is there a way I can make '**' or '~' as my operators to add two

Re: Friend wants to learn python

2005-07-27 Thread Gurpreet Sachdeva
http://www.byteofpython.info/download Wonderful book for newbie! Regards, G Blogs: http://garrythegambler.blogspot.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: f*cking re module

2005-07-04 Thread Gurpreet Sachdeva
try: re.search((python)(/python), str).group() except: print 'not found' otherwise, re.search((python).*?(\/python), str).group() this is will help! Regards, Gurpreet Singh Blogging [at] http://garrythegambler.blogspot.com On 4 Jul 2005 01:04:47 -0700, jwaixs [EMAIL PROTECTED]

Re: Getting into Python, comming from Perl.

2005-04-25 Thread Gurpreet Sachdeva
I also coded for more than 3 years and eventually I got that I was not coding but writting poems in perl... Even after 3 months, I go back and check my hand written code, I had to think twice about the logic used... Now its pretty much systematic which incode dcoumentation and programming

Module for handling Nested Tables in HTML

2005-04-12 Thread Gurpreet Sachdeva
Hi guys, Can anyone suggest some good tool for handling nested tables in a HTML page... BeautifulSoup is somehow not working with Nested Tables. Thanks and Regards, Garry -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expressions: large amount of or's

2005-03-02 Thread Gurpreet Sachdeva
Can divide the regex on the bases of alphabets they are starting with or can iterate on the list. Regards, Garry http://garrythegambler.blogspot.com/ On Wed, 02 Mar 2005 12:50:01 +0100, André Søreng [EMAIL PROTECTED] wrote: Ola Natvig wrote: André Søreng wrote: Yes, but I was

Re: Google Technology

2005-03-01 Thread Gurpreet Sachdeva
: I am just wondering which technologies google is using for gmail and : Google Groups??? Check this: http://tools.devshed.com/c/a/Search%20Engine%20Tricks/To-the-next-level-with-Google-Groups-2 Regards, Garry http://garrythegambler.blogspot.com/ --

Error in pywordnet

2005-02-26 Thread Gurpreet Sachdeva
I am using pywordnet and when ever I import the package from wordnet import *, I get an error: Exception exceptions.AttributeError: DbfilenameShelf instance has no attribute 'writeback' in ignored Now the package works fine until I tried to use that in Apache via CGI. Apache is showing a Server

Two classes problem

2005-02-02 Thread Gurpreet Sachdeva
I have two classes; a.py -- #!/usr/bin/python global test test ='' class a(b): def __init__(self,test): print test print 'Outside: '+test b.py -- #!/usr/bin/python import a a.a('Garry') I want to pass this string (or any object later) to a.py and that too outside the

Problem in importing MySQLdb

2005-01-20 Thread Gurpreet Sachdeva
I am using Mysql version 5.0.2-alpha on RedHat 9.0 (python2.2) When I try to import MySQldb I get: Python 2.2.2 (#1, Feb 24 2003, 19:13:11) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-4)] on linux2 Type help, copyright, credits or license for more information. import MySQLdb Traceback (most recent

pyPgSQL giving error!

2005-01-13 Thread Gurpreet Sachdeva
I am using Redhat 9.0/python2.3. I installed pyPgSQL-2.4.tar.gz and it was successfull. Now when I am trying to import that module, I got: Python 2.3.3 (#1, Jan 11 2005, 15:24:09) [GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2 Type help, copyright, credits or license for more information.

Re: pyPgSQL giving error!

2005-01-13 Thread Gurpreet Sachdeva
did you really do ./configure, make and make install? No, I did python setup.py build and python setup.py install where is libpq.* linpq is there in /usr/lib/python2.3/site-packages/pyPgSQL/ was a postgres installation present while doing ./configure et all? No, But I installed

Re: pyPgSQL giving error!

2005-01-13 Thread Gurpreet Sachdeva
And now when I did... cd /usr/local/lib/python2.3/site-packages/pyPgSQL/libpq/ [EMAIL PROTECTED] libpq]# python __init__.py Traceback (most recent call last): File __init__.py, line 23, in ? from libpq import * ImportError: ./libpqmodule.so: undefined symbol: PyUnicodeUCS2_EncodeDecimal

Upgraded to python2.3 but httpd taking old version

2005-01-11 Thread Gurpreet Sachdeva
I upgraded my python to 2.3 from 2.2 but Apache (V 2.0.4) is taking old libraries for processing. I also made a soft link redirecting the old files to new files but of no help... These error logs shows that it is still using 2.2 :o( [Tue Jan 11 16:18:45 2005] [error] [client 127.0.0.1] import

Re: file.readlines() - gives me error (bad file descriptor)

2005-01-06 Thread Gurpreet Sachdeva
On Thu, 6 Jan 2005 14:27:40 +0530, Binu K S [EMAIL PROTECTED] wrote: I'm sorry, I didn't get what you trying to say here. Where do you see a read altering the file? An example might help. Please try: logfile=file(r'test.txt','w+') logfile.write('datetime') Check the contents of test.txt, you

Re: file.readlines() - gives me error (bad file descriptor)

2005-01-05 Thread Gurpreet Sachdeva
I tried logfile=file(r'test.txt','w+') logfile.write('datetime') test=logfile.readlines() print test I got : Open an encoded file using the given mode and return a wrapped version providing transparent encoding/decoding. Note: The wrapped version will only accept the object

Re: file.readlines() - gives me error (bad file descriptor)

2005-01-05 Thread Gurpreet Sachdeva
logfile=file(r'test.txt','a+') logfile.write('datetime') logfile.flush() test=logfile.readlines() print test I added logfile.flush(), the 'datetime' was written in the file correctly but I couldn't get any result... Crazy! Garry -- http://mail.python.org/mailman/listinfo/python-list

Re: file.readlines() - gives me error (bad file descriptor)

2005-01-05 Thread Gurpreet Sachdeva
On Thu, 6 Jan 2005 12:55:22 +0530, Binu K S [EMAIL PROTECTED] wrote: The file's current position moves as you write into it. I concure and have figured out the solution BUT while reading from the file from the position where the file handler is, should return Null/Blank/Anything in this world BUT

Problem in threading

2004-12-29 Thread Gurpreet Sachdeva
I have written a code to figure out the difference in excecution time of a func before and after using threading... [CODE] #!/usr/bin/env python import threading import time loops = [5000,5000] def loop(self, nsec): for i in range(1,nsec): t=i*5000

Re: Problem in threading

2004-12-29 Thread Gurpreet Sachdeva
threads[i].join() Oh thanks I corrected that but still the time taken after using thread is more without using them Please Advice... Thanks, Gurpreet Singh -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem in threading

2004-12-29 Thread Gurpreet Sachdeva
I wrote: Also the difference of time is not much... How do we best optimize our task by using threads... please help... Duncan Booth Wrote: The only times when it may result in a decrease in the running time... are when the time the task...when multiple CPU's are involved. I fotgot to mention

Re: Problem in threading

2004-12-29 Thread Gurpreet Sachdeva
So That means blindly using threads on any process won't help! It depends on what help means to you. Help means to improve processing speed in achieving a particular task... *Help* here also means that I have a processor farm, how do I best use them to get maximum processing speed out of

Python on Linux Cluster

2004-12-22 Thread Gurpreet Sachdeva
I have shifted my python script on a 4 node open ssi cluster. Please guide me what changes do I have to do in my python scripts to fully utilize the cluster. How do we introduce parralel processing in python??? -- Thanks and Regards, GSS -- http://mail.python.org/mailman/listinfo/python-list

word to digit module

2004-12-21 Thread Gurpreet Sachdeva
Is there any module available that converts word like 'one', 'two', 'three' to corresponding digits 1, 2, 3?? Thanks and Regards, GSS -- http://mail.python.org/mailman/listinfo/python-list