Re: [Tutor] knowing when a list is updated by a thread

2008-04-23 Thread linuxian iandsd
if i only wanted the last element ofthe list, i would change the "geoCode.getResults()' to return to me both the complete list & the new elements in the list. it should be pretty easy from there. if what you need is to sort the list & see whether a value have changed or not then you will be better

Re: [Tutor] XMLRPC

2008-04-22 Thread linuxian iandsd
> > looking for a way to run commands remotely on another computer. > I can run pretty much complicated commands on remote servers using only ssh. I also run programs on remote server (when inside lan) using cgi module, works perfectly. maybe if you describe your problem i can provide you with so

Re: [Tutor] Sending Mail

2008-04-22 Thread linuxian iandsd
i can send email w/ no problem using this : import smtplib smtp = smtplib.SMTP() smtp.connect('smtp_server_here') smtp.login('user_name', 'password') smtp.sendmail(strFrom, strTo, msgRoot.as_string()) smtp.quit() ___ Tutor maillist - Tutor@python.org h

Re: [Tutor] Arguments ina separate file

2008-04-21 Thread linuxian iandsd
> > import myargs this one is clever ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HTML Parsing

2008-04-21 Thread linuxian iandsd
Another horrid solution > #!/usr/bin/python > # line number does not change so we use that # the data we're looking for does not have a (unique) close tag (htmllib > ) > > import re, urllib2 > file=urllib2.urlopen('http://10.1.2.201/server-status') > n=0 > for line in file: > n=n+1 > if n=

Re: [Tutor] Reading Multiple Files in Sequence

2008-04-18 Thread linuxian iandsd
if you only want to start a loop to parse all files in a directory try something like this: import glob > > n=0 > for file in > glob.glob('/Users/Kelvin/TEMPDATASET/CLEANEDFIELDDATA/WEST/*'): > n=n+1 > new_output_file='/Users/Kelvin/TEMPDATASET/PCA/'+ str(n) + '.txt' > output = open(new_output_

Re: [Tutor] Error with incorrect encoding

2008-04-17 Thread linuxian iandsd
Kent was right, >>> print u'\xae'.encode('utf-8') > (R) > but i think you are using the wrong source file, i mean don't copy & paste it from your browsers 'VIEW SOURCE' button. use python native urllib to get the file. ___ Tutor maillist - Tutor@pyth

Re: [Tutor] python assignments

2008-04-17 Thread linuxian iandsd
http://www.pythonchallenge.com/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Hoping to benefit from someone's experience...

2008-04-17 Thread linuxian iandsd
just a thought ... there must be some way of using OpenOffice to convert your ORIGINAL word documents into HTML files ... then as html is a very nice & structured language that you can manipulate & modify with ease just by adding some tags inside where you want or wish this is also only if yo

Re: [Tutor] Font capture from webpages

2008-04-14 Thread linuxian iandsd
> I want to find the font style,Font size written in webpage without looking > > into source code. > > > your best bet would be your eyes. otherwise python will need to parse the source code to tell. ___ Tutor maillist - Tutor@python.org http://mail.p

Re: [Tutor] input and output files from terminal

2008-04-14 Thread linuxian iandsd
i think you need to try : cat input.txt | /usr/bin/python test.py >output.txt > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Simple copy script

2008-04-12 Thread linuxian iandsd
right ! show us what you've done so far. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] queries from the web & random number

2008-04-11 Thread linuxian iandsd
i see no body has replied to my question, probably you are thinking this guy is hijicking someones website ? well, i can assure you i am not. simply because i have a username/password for this site, plus, I have thier agreement to automate the process of utilizing thier database all i want from mi

Re: [Tutor] SQLite LIKE question

2008-04-11 Thread linuxian iandsd
i forgot to mention that you need to try your sql commands out of your script before trying them inside, ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] SQLite LIKE question

2008-04-11 Thread linuxian iandsd
I m not sure this is your case but i believe you are missing the "cur.fetchall()" command which does fetch data from sql db i suggest you put a print statement for every data you use in your program that way you know whats empty & whats not... here is example of MySQLdb process: con=MySQLdb.c

Re: [Tutor] queries from the web & random number

2008-04-10 Thread linuxian iandsd
i was wondering if there was there any means of sending this number to the script thru the web. I mean have the script run from cron & i can remotely access the image read the code & enter the code in a form to be "submitted to my script" or another script i don't mind as long as it gets to final d

Re: [Tutor] queries from the web & random number

2008-04-10 Thread linuxian iandsd
I modified old script - added get_img=urllib2.urlopen('http://website.com/jcaptcha.jpg') > secret_img=open('/home/iandsd/secret_img.jpg','wb') > secret_img.write(get_img.read()) > secret_img.close() > and then to add the value to the dictionary : values['captcha']=raw_input("Enter the number you

[Tutor] queries from the web & random number

2008-04-10 Thread linuxian iandsd
I have been used to making queries to websites automatically & analizing the results. a few minutes ago ... i can no longer do that now a website is protected by a ramdom number that i have to enter before i can login. its a picture with numbers on it that i have to type in in the authentication fo

Re: [Tutor] List comprehensions

2008-04-10 Thread linuxian iandsd
i think you are using ajax ... which undoubdetly uses an sql database since its based on queries run from whithin the application in the browser whithout the need for refreshing the page ... i would suggest you try serching internet for something like "google autocomplete feature" & i guess the qu

Re: [Tutor] List comprehensions

2008-04-10 Thread linuxian iandsd
also if you need to go for 2 results I propose you use filters & interactive menus which will help you tailor the query to the users desires & thus limit the query results. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinf

Re: [Tutor] Copy script

2008-04-10 Thread linuxian iandsd
could you do a : "dir /b" inside this directory just so that we can know the real file names. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List comprehensions

2008-04-09 Thread linuxian iandsd
i can't think of anything but a loop here UNLESS you take the list from its source one element at a time, process it & then print the result. example of this would be : list comes in from standard input. list comes from a database list is read from a file. so again whe

Re: [Tutor] List comprehensions

2008-04-09 Thread linuxian iandsd
On Wed, Apr 9, 2008 at 7:44 PM, Jerry Hill <[EMAIL PROTECTED]> wrote: > On Wed, Apr 9, 2008 at 7:12 AM, Dinesh B Vadhia > <[EMAIL PROTECTED]> wrote: > > I want to replace the for loop with a List Comrehension (or whatever) to > > improve performance (as the data list will be >10,000]. At each sta

Re: [Tutor] Tutor Digest, Vol 50, Issue 9

2008-04-09 Thread linuxian iandsd
On Wed, Apr 9, 2008 at 12:59 PM, rui <[EMAIL PROTECTED]> wrote: > Hi Gloom, > > > > You should give a look at the method "split" (of the string objects) and > int. > > The first is used do break a string into smaller pieces and the other to > convert a string to an int object, raising an exception

Re: [Tutor] socket / over network

2008-04-09 Thread linuxian iandsd
in case it helps here is a very basic example: import MySQLdb, glob, os, re, shutil from ftplib import FTP a=file_to_fetch ftp=FTP('ftp_server') ftp.login('user_name','password') try: aa=ftp.nlst(a) b='/home/a' bb=os.path.basename(aa[0]) e=os.path.basename(b) c=open(b, 'wb')

Re: [Tutor] Don't miss "Python-by-example - new online guide to Python Standard Library"

2008-04-04 Thread linuxian iandsd
well, good to see something like this comming ... i used to browse for hours to find nothing but long long documentation & not a single real life example... but i guess its because i m used to the old 'howto' way of ducumentation ... On Fri, Apr 4, 2008 at 2:12 PM, Dick Moores <[EMAIL PROTECTED

Re: [Tutor] socket / over network

2008-04-03 Thread linuxian iandsd
re-inventing the wheel ? http://www.howtoforge.com/linux_backuppc > > > On Thu, Apr 3, 2008 at 3:44 PM, Alan Gauld <[EMAIL PROTECTED]> > wrote: > > > "Nathan McBride" <[EMAIL PROTECTED]> wrote > > > > Hi Nathan, > > > > Please don't reply to an existing message to start a new discussion. > > It m

Re: [Tutor] parse emails as they come in

2008-04-02 Thread linuxian iandsd
arsed file looks like this : field1: x field2: x field17: x empty line here for end of message On Wed, Apr 2, 2008 at 9:50 AM, Steve Willoughby <[EMAIL PROTECTED]> wrote: > linuxian iandsd wrote: > > > well, i don't know how to pipe the file to my script !! &

Re: [Tutor] parse emails as they come in

2008-04-01 Thread linuxian iandsd
zations you told me (directly inserting data into mysql & the lines loop as well) thanks a lot. On Tue, Apr 1, 2008 at 9:17 PM, Steve Willoughby <[EMAIL PROTECTED]> wrote: > On Tue, Apr 01, 2008 at 09:07:04PM +, linuxian iandsd wrote: > > a=open('/home/john/data/file_i

Re: [Tutor] parse emails as they come in

2008-04-01 Thread linuxian iandsd
, Mar 28, 2008 at 1:08 PM, Chris Fuller > > <[EMAIL PROTECTED]> > > > > wrote: > > > The email and mailbox modules might help you out. Multiple email > > > messages will probably parse as an mbox format mailbox. > > > > > > http://docs.python.org/lib/module

[Tutor] parse emails as they come in

2008-03-28 Thread linuxian iandsd
good morning everybody ! I have scripted a small program to parse a 5 lines email message as it comes in to my inbox (this is handled by procmail & here is a wonderful intro to it : http://linuxfocus.org/English/November1997/article8.html) so every email is being parsed & information is extracted

Re: [Tutor] login

2008-03-16 Thread linuxian iandsd
well, you first get to the authenticating page, that is where you put your username & pass ! & then you post them to be authenticated by server which then sends you a session id, which is a cookie. now to make the server think you're loged in to the site you have to send him back the cookie. now

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread linuxian iandsd
el.loc (127.0.0.1): icmp_seq=1 ttl=64 time=0.134ms --- serv.kontactel.loc ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.134/0.134/0.134/0.000 ms >>> i hope you can understand that now u have the output in a variable called "a" t

Re: [Tutor] how to get response from os.system()

2008-03-16 Thread linuxian iandsd
use os.popen("your cmd here") On Sun, Mar 16, 2008 at 8:06 PM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > shawn bright wrote: > > Lo there all, > > > > I am needing to get a response back from a system command. > > i can do this: > > > > os.system('mailq | wc -l") > > > > if i do this in

Re: [Tutor] Correct way to call an outside program?

2008-03-13 Thread linuxian iandsd
simplest way to run external commands ! import os cmd="/usr/bin/ssh 10.0.0.20 uptime" os.popen(cmd) my cmd is just an example, use any cmd you want & its output will be displayed to you. hope this helps On Thu, Mar 13, 2008 at 12:05 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > Allen Fowler

[Tutor] authentication again a crm web application

2008-02-29 Thread linuxian iandsd
hi everyone, I need to get pass throught an authentication form (username & password) to access our client CRM web application automaticaly, which means at some intervals of time i need to log in to thier web site download a specific table parse it & then load it into my mysql database. the parsing