Re: Change Gateway Programmatically
Thanx again. -- http://mail.python.org/mailman/listinfo/python-list
Re: Change Gateway Programmatically
Well netsh turned out to be the perfect solution for my problem(even though doing it in python would have given me some kicks). I managed it with two .bat files for toggling the gateway ips. Thank you friend. -- http://mail.python.org/mailman/listinfo/python-list
Change Gateway Programmatically
Dear Pythoneer, I need to toggle the gateway ip of my windows xp machine quite often due to some software requirements. I just want to know whether i could do it programmatically using Python. If so how? -- http://mail.python.org/mailman/listinfo/python-list
Re: books: Dive into Python vs Beginning Python
I would recommend both, but as i have already bought the first version of Beginning Python known as Practical Python by Magnus. I can gaurantee you that the practical projects as well as the succinct python tutorial in the book will show you the full power and glory of Python. Magnus is a great author, believe me! -- http://mail.python.org/mailman/listinfo/python-list
Re: How to get started in GUI Programming?
Try http://boa-constructor.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Cmd Module
Sorry! I just retyped my script instead of copy pasting it. well thank u once again for clearing my confusion. -- http://mail.python.org/mailman/listinfo/python-list
Cmd Module
Dear Pythoneer, I was just curious about using the cmd module for building my own command line interface. i saw a problem. The script is as follows: from cmd import Cmd import getpass class CmdTest(cmd): def __init__(self): super(CmdTest, self).__init__() def do_login(self): passwd = getpass.getpass() if passwd = 'godwin': print "You are a valid user" if __name__ == '__main__': ctest = CmdTest() ctest.cmdloop() The interpreter reports that the first argument to super should be a type rather than a class object and for the do_login function it says that function needs only one argument but two are given. I solved the above errors by adding the following code: Cmd.__init__(self) def do_login(self,passwd='godwin') But i know that my first code should work without any problems or is there a problem with it. Pls enlighten me. -- http://mail.python.org/mailman/listinfo/python-list
Re: print there!
i didn't notice it and i'm really sorry. it works beautifully! thanks once again :) -- http://mail.python.org/mailman/listinfo/python-list
Re: print there!
thanks :) It works beautifully. -- http://mail.python.org/mailman/listinfo/python-list
Re: print there!
i think u've misunderstood my question. Your solution will print on a new line as below: c:\godwin\bl.csv 1 c:\godwin\bl.csv 2 c:\godwin\bl.csv 3 But i want this number to diplay their value increase on the same line on the same sport itself without printing the filename multiple times on multiple lines: c:\godwin\bl.csv ^ If i were to do it in the c language i would use the conio.h and gotxy function with printf. printf("c:\\godwin\\bl.csv"); for(i=0;ihttp://mail.python.org/mailman/listinfo/python-list
print there!
Dear Pythoneer, I am writing a python script which inserts or updates a database from a csv file. i've done the functionality. But i would to like to show the user the current row being inserted or updated in the screen. This can be done as follows: print 'c:\godwin\bl.csv', for i,row in enumerate(reader): # inserts or updates the database print i, This displays on the screen as : c:\godwin\bl.csv 1 2 3 4 5 6 7 8 ^ But i want it to show the above numbers on the same spot denoted by the carat character. Can it be done with print statement or any other trick? -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
yes i did hear about sqlobject but as u said it doesn't support oracle yet. Thanx -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
Thanx for the links , i loved the "monty lingua" module u gave me before. -- http://mail.python.org/mailman/listinfo/python-list
Re: Eve from Adams' Ribs
www.devx.com/dbzone/Article/22093 U've made a point and i have seen that approach in the above article. But i was curious about creating python classes and code on fly. The only way i could do it was by using exec function. Is there a standard way of doing it. What are the plus points of such kind of programming? Is it only done by hackers? Sorry for asking the wrong question for getting the right answer! -- http://mail.python.org/mailman/listinfo/python-list
Eve from Adams' Ribs
Dear Pythoneer, I'm thinking of making a class out of an rdbms table name(let's say oracle). I can dynamically query the column names and their datatypes from oracle. So at runtime can i create a class object that creates a class for example employee with methods that can manipulate that table. For example : class Employee(object): def insert(self,**kwds): "should insert values into the table based on column and value pairs supplied" def update(self,**kwds): "should update the table" def delete(self,where): "should delete a row" def select(self,*cols,where) "should retrieve results based on columns and where clause" But the funny fact is that i want this class to be dynamically generated at run time simply from a table name string. "Yes i want to create Eve out of Adams' rib". I think its possible with python as it is called a dynamic language. Would u let me on this python secret? -- http://mail.python.org/mailman/listinfo/python-list
Re: Web App like Google
Actually i went through the NLTK site tutorials and it has a steep learning curve associated with it. Well if i can learn it, it will be the best fit module for my app. But if it gets hard, i'll definitely opt for the text indexers u gratefully pointed to me. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Web App like Google
Thanks for making me aware of the security loophole of the web app i am planning. Godwin Burby -- http://mail.python.org/mailman/listinfo/python-list
Re: Web App like Google
Thanks for providing me with all those informative links about NLTK nad CNL. I'll certainly look into it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Web App like Google
Thanks for informing me about NLTK. I'll certainly look into it and other options. Hope my dream doesn't go into the graves. Godwin Burby -- http://mail.python.org/mailman/listinfo/python-list
Web App like Google
Hello there, I need some thoughts about a web application that i am dreaming and drooling about in python. I want a search page to look exactly like Google. But when i press the search button, it should search a database in an rdbms like Oracle and provide results. For example, if my keywords are "all customers with names starting with 'God'" it should somehow search table CUSTOMER , with following query : SELECT CUSTNAME FROM CUSTOMER WHERE CUSTNAME LIKE 'God%' So we basically need is a good python parser module which parses the keywords into an sql or sqls and list the results. I can look in the keywords for table and column synonyms and map it into table and column names and create sql but it's not a foolproof idea as we all know that english is a very vague language. The above idea wil fail , if i can't identify table,column names ,operators and values in their logical orders so as to create a syntactically correct sql. If there are more tables involved, i should also think of joining tables (inner,outer,equi joins). All I want is some enlightening thoughts from the python hackers(i mean programmers) out there.Plz polish your grey cells and let me know your thoughts. # this is my basic and foolish keywordparser # the object db provides the table as well as column names # as u can see it may or may not work even for a single table class KeyWordParser(object): def __init__(self,keywords,db): self.keywords = keywords.upper().split() self.db = db self.tables = [] self.columns = [] def parse2sql(self): for word in self.keywords: if word in self.db.tables(): self.tables.append(word) for word in self.keywords: for table in self.tables: for column in self.db.columns(table): if column == word: self.columns.append(column) sql = 'SELECT %s FROM %s' % (','.join(self.columns) or '*',','.join(self.tables)) return sql -- http://mail.python.org/mailman/listinfo/python-list
DBSeek
Hello there, I need some thoughts about a web application that i am dreaming and drooling about in python. I want a search page to look exactly like Google. But when i press the search button, it should search a database in an rdbms like Oracle and provide results. For example, if my keywords are "all customers with names starting with 'God'" it should somehow search table CUSTOMER , with following query : SELECT CUSTNAME FROM CUSTOMER WHERE CUSTNAME LIKE 'God%' So we basically need is a good python parser module which parses the keywords into an sql or sqls and list the results. I can look in the keywords for table and column synonyms and map it into table and column names and create sql but it's not a foolproof idea as we all know that english is a very vague language. The above idea wil fail , if i can't identify table,column names ,operators and values in their logical orders so as to create a syntactically correct sql. If there are more tables involved, i should also think of joining tables (inner,outer,equi joins). All I want is some enlightening thoughts from the python hackers(i mean programmers) out there.Plz polish your grey cells and let me know your thoughts. # this is my basic and foolish keywordparser # the object db provides the table as well as column names # as u can see it may or may not work even for a single table class KeyWordParser(object): def __init__(self,keywords,db): self.keywords = keywords.upper().split() self.db = db self.tables = [] self.columns = [] def parse2sql(self): for word in self.keywords: if word in self.db.tables(): self.tables.append(word) for word in self.keywords: for table in self.tables: for column in self.db.columns(table): if column == word: self.columns.append(column) sql = 'SELECT %s FROM %s' % (','.join(self.columns) or '*',','.join(self.tables)) return sql -- http://mail.python.org/mailman/listinfo/python-list
Re: I am a Java Programmer
Buy the book "Practical Python" by Magnus Lie Hetland. It contains 10 practical projects to let u get started on you own "Pythoneering"( as Magnus calls it). Move on buddy. -- http://mail.python.org/mailman/listinfo/python-list
Re: What are the other options against Zope?
You understood my request correctly. I thank u for pointing me to cherrypy. -- http://mail.python.org/mailman/listinfo/python-list
Re: What are the other options against Zope?
Actually i want to create a "google" like web interface to any rdbms and search as we all do it in google.That would be great isn't it. Thank u for your queries. -- http://mail.python.org/mailman/listinfo/python-list
What are the other options against Zope?
Hi all, I wanna thank Martin for helping out with my ignorance concerning execution of stored procedure with python. Now i have decided to write a web app that googles into my companies proprietary database. I need to know whether zope is good for that job. But even the introduction to zope in the zope book was intimidating. Are there any simple options? If so plz tell me how i can obtain it and study it. I should say that i am new to web programming. Thank you -- http://mail.python.org/mailman/listinfo/python-list
How to execute stored procedure?
Hi, I would like to execute an oracle stored procedure using the any oracle database module which satisfies the Database Specification standard. I have tried cxOracle and Odbc database packages with no success. If u have the answer plz give me an example code. Thank you -- http://mail.python.org/mailman/listinfo/python-list
Progress Bar with urllib2
I'm trying to write a python script to download data (well, files) from a HTTP server (well, a PHP script spitting them out, at least). The file data is just the returned data from the request (the server script echoes the file and then dies). I call the page using urllib2, like so: satelliteRequest = urllib2.Request(satelliteServer + "?command=download&filepath="+filepath) satelliteRequestData = {"username":satelliteUsername, "password":satellitePassword} satelliteRequest.add_data(urllib.urlencode(satelliteRequestData)) satelliteOpener = urllib2.build_opener() satelliteOpener.addheaders = [('User-agent', userAgent)] Now, if I want to download the file all at once, I just do satelliteData = satelliteOpener.open(satelliteRequest).read() But some of these files are going to be really, really big, and I want to get a progress bar going. I've tried doing a while loop like this: chunkSize = 10240 while 1: dataBuffer = satelliteOpener.open(satelliteRequest).read(chunkSize) data += dataBuffer if not dataBuffer: break But that just gives me the first 10240 bytes again and again. Is there something I'm missing here? It might even be I'm calling urllib2 the wrong way (does it download when you read() or when you create the Request?) All help is appreciated, I'm sort of stuck here. Andrew Godwin -- http://mail.python.org/mailman/listinfo/python-list