[Tutor] Open a WebPage with Forms Authentication

2010-03-31 Thread GoodPotatoes
I would like to sign onto a web page, but am having a difficult time determine what parameters to pass in my sign in. For a simple test, I am trying to parse text on a "friends" status page on twitter. This is not via the API, but the web. import urllib2, urllib, cookielib opener = urllib2.bu

[Tutor] From SQL Blobs to Python Buffers to Actual Files

2010-06-03 Thread GoodPotatoes
Environment: Sybase/ODBC/Windows/Python2.5 I have been given a legacy database, and need to read the binaryfiles out to a disk. The table has columns "filename" and "binaryFile", where the binaryFile is a BLOB My python script so far is: import pyodbc cnxn=pyodbc.Connection("DSN=sybasedatabas

Re: [Tutor] From SQL Blobs to Python Buffers to Actual Files

2010-06-04 Thread GoodPotatoes
om SQL Blobs to Python Buffers to Actual Files On Fri, 4 Jun 2010 10:57:07 am GoodPotatoes wrote: > I have been given a legacy database, and need to read the binaryfiles > out to a disk. The table has columns "filename" and "binaryFile", > where the binaryFile

[Tutor] Iterating through objects

2009-08-16 Thread GoodPotatoes
I'm not sure if I've been searching using the correct terms. After I've iterated through an object, such as a cursor or webpage, how do I get back to the "top"? e.g. tutorial from http://www.daniweb.com/code/snippet563.html# print page1.readlines() >From this excercise, the first time I read

[Tutor] Best Practice: Subroutines and Loop logic

2009-09-03 Thread GoodPotatoes
Hello, I am trying to find the best way to do this. My goal is to only call this subroutine only ONCE, and the logic is contingent upon two outputs. lWords=[...] # List of many, many words lData=[...] #list of some words that need to be validated against lWords #subroutine to search for words,

[Tutor] Simple regex replacement match (converting from Perl)

2009-09-04 Thread GoodPotatoes
I simply want to remark out all non-word characters read from a line. Line: Q*bert says "#...@!$% " in Perl #match each non-word character, add "\" before it, globally. $_=s/(\W)/\\$1/g; output: Q\*bert\ says\ \"\...@\!\$\%\ \ \" #perfect! Is there something simple like this in python? I

[Tutor] Putting a variable into a statement

2009-10-15 Thread GoodPotatoes
I am using the module active_directory and have an ad object called myuser. I would like to run a series of statements like: myuser.attribute where attribute is a string variable, but python says that this is not the correct syntax. error: for x in myuser.properties:# "myuser.properties" r

[Tutor] Faster list searching?

2009-11-18 Thread GoodPotatoes
I'm dealing with bigger lists than I have been, and noticed this is getting really slow. Is there a faster way to do this? for x in list1: if x not in list2: list3.append(x) My search is taking up to 5 minutes to complete. __ Do You

[Tutor] Calling a python script using subprocess

2011-04-28 Thread GoodPotatoes
I am trying to execute a python script using the subprocess module.  I am feeding parameters into the script, which reads them using argparse and returns a list. The script simply returns a list when called.  When I execute my script from my prompt, I get the following: H:\pythonscripts>install