[Tutor] How to open a telnet session and have the python program write to it.
Hi, I am attempting a python program that will open a telnet session and input the username/password, cd to a certain directory and leave the session there. I have attempted different combinations of the os.popen etc but as soon as the telnet window is opened the program cannot be coaxed to write to the telnet session (window). I have attempted the telnetlib, but the problem is that the telnet window does not show up. Can anyone give me more info in this matter? Thanks lots, -Suri. __ Name Suri Chitti | Sr. QA Engineer, WM-OS-QA Manhattan Associates Phone: 00 91 80 28418080 xtn.4830 Fax: 00 91 80 51156098 [EMAIL PROTECTED] http://www.manh.com __ Looking for a new perspective on your supply chain? Plan now to attend Momentum 2005 on May 15 - 18 in Scottsdale, Arizona. Visit http://www.momentummanh.com today and register early for best rates! Momentum 2005 New Perspectives. Infinite Possibilities. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to open a telnet session and have the python programwrite to it.
I am attempting a python program that will open a telnet session and input the username/password, cd to a certain directory and leave the session there. I have attempted different combinations of the os.popen etc but as soon as the telnet window is opened the program cannot be coaxed to write to the telnet session (window). I have attempted the telnetlib, but the problem is that the telnet window does not show up. Try pyexpect I think you have to download it though. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] resizing an array of strings?
On 6 Jun 2005, [EMAIL PROTECTED] wrote: Hello, I'm having a bit of trouble resizing/reshaping an array of strings. here's what I'm trying to do: myString = ['hi','my','name','is','Jeff'] reshape(myString, (2,2)) What I get from this is something like: [['h','i'], ['m','y']] What I want is: [['hi','my'], ['name','is']] If you explained exactly what you want (and showed what you tried to do) it would be easier to help. What does e.g. the tuple `(2,2)' mean? Here's is an example which should give you an idea how to solve the problem: . s = ['hi','my','name','is','Jeff'] . s[0:2] . ['hi', 'my'] . s[2:4] . ['name', 'is'] Your reshape function just has to create the list slices. Karl -- Please do *not* send copies of replies to me. I read the list ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] CPAN for python
Is there a site like Perl's CPAN for Python? I've seen the stuff at ActiveState. Anything else? Ron Nixon __ Discover Yahoo! Have fun online with music videos, cool games, IM and more. Check it out! http://discover.yahoo.com/online.html ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] CPAN for python
On Mon, 6 Jun 2005, Ron Nixon wrote: Is there a site like Perl's CPAN for Python? I've seen the stuff at ActiveState. Anything else? Hi Ron, Yes, there is a system called 'PyPI': http://www.python.org/pypi I hope this helps! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] CPAN for python
On Mon, Jun 06, 2005, Danny Yoo wrote: On Mon, 6 Jun 2005, Ron Nixon wrote: Is there a site like Perl's CPAN for Python? I've seen the stuff at ActiveState. Anything else? Hi Ron, Yes, there is a system called 'PyPI': http://www.python.org/pypi There's also the vaults of parnassus http://www.vex.net/parnassus/ Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC UUCP: camco!bill PO Box 820; 6641 E. Mercer Way FAX:(206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676 URL: http://www.celestial.com/ There are three kinds of men. The ones that learn by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves. -- Will Rogers ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] CPAN for python
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Danny Yoo Yes, there is a system called 'PyPI': http://www.python.org/pypi Also see EasyInstall (http://peak.telecommunity.com/DevCenter/EasyInstall). Installs packages from the command line by searching PyPI. It's pretty new from what I gather. Much more info at the above address. Christian http://www.dowski.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Database connections don't stay alive
Hi there, I have mainly used the psycopg module to connect. It seems to work quite well. quick example: import psycopg conn = psycopg.connect(dbname=mydatabase password= host= user=) cur = conn.cursor() cur.execute('select * from transit;') results = cur.fetchall() Hope this helps, Joe Olli Rajala wrote: Well, I asked about tutorials, but maybe this was not so good day, because it has been quite silent. :) So, good tutorials are still welcome, though I know now how to connect to the Postgresql database. I just have some problems, though. With MySQL I can do like this: import MySQLdb def connectDB(): try: db = MySQLdb.connect(host='localhost', user='user', db='pictures', passwd='passwd') cursor = db.cursor() return cursor except: print 'Error' cursor = connectDB() cursor.execute('SELECT * FROM categories') print cursor.fetchall() And everything works as I thought. But with Postgre, it seems that the connection don't stay alive. I mean, with the same kind of code: from pyPgSQL import PgSQL def connectDB(): try: db = PgSQL.connect(host='localhost', database='pictures', user='user', password='passwd') return db.cursor() except: print Error cursor = connectDB() cursor.execute(SELECT * FROM categories) print cursor.fetchall() The result is: Traceback (most recent call last): File test.py, line 23, in ? cursor.execute(SELECT * FROM categories) File /usr/lib/python2.4/site-packages/pyPgSQL/PgSQL.py, line 2992, in execute raise InterfaceError, execute failed - the cursor is closed. libpq.InterfaceError: execute failed - the cursor is closed. So, what's the solution for this? I saw somewhere some mentions about 'connection pooling', what's that and how I'm supposed to use that? It's quite hard to code when you don't have good manuals and have to put together information from very different sources and try to make it work... For example, this is from a manual I've used: 2.1.3.1 PQconnectdb Syntax: c = PQconnectdb(conninfo) Where conninfo is a string containing connection information. What the heck is 'conninfo', I mean, what's it's syntax? Yeah, I was finally able to figure it out, but it took hours googling, trying and stumbling. Okay, okay, back to business. Hope that someone will be able to help me. :) Yours sincerely, -- Joe Healy | Engineer OMC-International | 6 Paterson St | Abbotsford, VIC 3067 Melbourne | Australia Phone +61 (3) 9412 6500 | Fax +61 (3) 9415 9105 www.omc-international.com.au Dedicated to safer and more efficient shipping. CONFIDENTIAL COMMUNICATIONS. The information contained in this e-mail is confidential and may be subject to legal professional privilege. It is intended solely for the addressee. If you received this correspondence by mistake, please promptly inform us by reply e-mail or by telephoning +61 3 9412 6500 and then delete the e-mail and destroy any printed copy. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor