Re: Can't create list of dictionaries

2009-04-10 Thread sophie_newbie
Scratch everything I said, copy() does work. Made a wee mistake somewhere else. Apologies if I've wasted anyones time! On Apr 10, 12:36 pm, sophie_newbie wrote: > Hi there, > > I've got a function that returns a dictionary, I need to loop and > return 1000 dictionarie

Can't create list of dictionaries

2009-04-10 Thread sophie_newbie
Hi there, I've got a function that returns a dictionary, I need to loop and return 1000 dictionaries and append them to a list, but the thing is that when I do the list.append(funtThatReturnsDict()) the resulting only ever has 1 dictionary attached to it, even after running the append function 100

Best way to spawn process on back end computer

2008-10-16 Thread sophie_newbie
Hi, I'm running a python cgi script on a frontend web server and I want it to spawn another script (that takes a long time to run) on a backend number crunching server thats connected to the same network. What do you think is the best way to do this? I have a few ideas but I'm sure there is a "bes

Reporting the line number of an exception

2008-05-29 Thread sophie_newbie
I'm sure this is exceedingly simple but I can't find it anywhere. When I catch an exception I would like to report the line number of the exception as well as the error info. try: someError() except Exception, e: "print_error_and_line_number" How do I find the line number? Thanks for any

Re: Setting expirty data on a cookie

2008-04-24 Thread sophie_newbie
On Apr 24, 12:41 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > On Apr 22, 8:38 pm, David <[EMAIL PROTECTED]> wrote: > > > On Tue, Apr 22, 2008 at 6:21 PM,sophie_newbie<[EMAIL PROTECTED]> wrote: > > > Does anyone know how to do this? I can't seem to

Re: Setting expirty data on a cookie

2008-04-24 Thread sophie_newbie
On Apr 22, 8:38 pm, David <[EMAIL PROTECTED]> wrote: > On Tue, Apr 22, 2008 at 6:21 PM,sophie_newbie<[EMAIL PROTECTED]> wrote: > > Does anyone know how to do this? I can't seem to make it work. > > > I'm using: > > > c = Cookie.SimpleCookie() >

Re: Spawing a thread and printing dots until it finishes

2008-04-24 Thread sophie_newbie
On Apr 24, 12:32 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > On Apr 22, 3:10 pm,sophie_newbie<[EMAIL PROTECTED]> wrote: > > > > > Hi, I'm trying to write a piece of code that spawns a thread and > > prints dots every half second until the thread spawn

Re: Spawing a thread and printing dots until it finishes

2008-04-24 Thread sophie_newbie
On Apr 22, 3:10 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > Hi, I'm trying to write a piece of code that spawns a thread and > prints dots every half second until the thread spawned is finished. > Code is > something like this: > > import threading > c

Re: Spawing a thread and printing dots until it finishes

2008-04-22 Thread sophie_newbie
On Apr 22, 4:41 pm, "D'Arcy J.M. Cain" <[EMAIL PROTECTED]> wrote: > On Tue, 22 Apr 2008 07:10:07 -0700 (PDT) > > > > sophie_newbie<[EMAIL PROTECTED]> wrote: > > import threading > > class MyThread ( threading.Thread ): > >

Setting expirty data on a cookie

2008-04-22 Thread sophie_newbie
Does anyone know how to do this? I can't seem to make it work. I'm using: c = Cookie.SimpleCookie() c['data'] = "unamepwordwhatever" c.expires = time.time() + 300 print c This doesn't seem to work, so I'm assuming isn't the correct way to set an expiry data? Anyone able to help me out here? Th

Spawing a thread and printing dots until it finishes

2008-04-22 Thread sophie_newbie
Hi, I'm trying to write a piece of code that spawns a thread and prints dots every half second until the thread spawned is finished. Code is something like this: import threading class MyThread ( threading.Thread ): def run ( self ): myLongCommand()... import time t = MyT

Re: Problem setting cookie in Internet Explorer

2008-04-21 Thread sophie_newbie
On Apr 21, 4:24 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Apr 21, 10:13 am, sophie_newbie <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > I'm using the python to set a cookie when a user logs in. Thing is it > > doesn't seem to be setti

Problem setting cookie in Internet Explorer

2008-04-21 Thread sophie_newbie
Hi, I'm using the python to set a cookie when a user logs in. Thing is it doesn't seem to be setting properly in Internet Explorer. It works grand in Firefox. Its basically: c = Cookie.SimpleCookie() c['username'] = uname c['password'] = pword print c print pageContent And thats it. I've a s

Re: Copy Stdout to string

2008-04-01 Thread sophie_newbie
On Apr 1, 3:03 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > Hi, I'm wondering if its possible to copy all of stdout's output to a > string, while still being able to print on screen. I know you can > capture stdout, but I still need the output to appear on the screen

Copy Stdout to string

2008-04-01 Thread sophie_newbie
Hi, I'm wondering if its possible to copy all of stdout's output to a string, while still being able to print on screen. I know you can capture stdout, but I still need the output to appear on the screen also... Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Get cgi script to begin execution of another script...

2008-03-12 Thread sophie_newbie
I've posted something similar to this already, but now I'm more sure of what I'm asking. Basically I've a CGI script, that when executed by the user, I want to call another script that does a very long running task (10 hours +) and print a message on the screen saying that the user will be emailed

Re: Keep a python script running after browser window closed

2008-03-10 Thread sophie_newbie
On Mar 7, 4:33 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 7, 10:28 am, sophie_newbie <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have a cgi script that performs a very long computation that can > > take several hours to complete. Is there any sm

Keep a python script running after browser window closed

2008-03-07 Thread sophie_newbie
Hi, I have a cgi script that performs a very long computation that can take several hours to complete. Is there any smart way that I can keep this script running until it is finished (after the user has closed the browser) and email them with the results. The email bit isn't the problem, I just do

Re: Create thumbnail image (jpg/png) of PDF file using Python

2007-11-21 Thread sophie_newbie
On Nov 20, 5:36 pm, sophie_newbie <[EMAIL PROTECTED]> wrote: > Is there any way to do this directly within python? > > If not is there any other good way to achieve it? > > Thanks in advance for any help! I think I've solved this problem using a piece of software called

Create thumbnail image (jpg/png) of PDF file using Python

2007-11-20 Thread sophie_newbie
Is there any way to do this directly within python? If not is there any other good way to achieve it? Thanks in advance for any help! -- http://mail.python.org/mailman/listinfo/python-list

Re: Downloading file from cgi application

2007-11-05 Thread sophie_newbie
On Nov 5, 1:50 pm, Jeff McNeil <[EMAIL PROTECTED]> wrote: > You could also just store the files outside of the document root if > you don't want to worry about a database. Then, as Jeff said, just > print the proper Content-Type header and print the file out. > > On Nov 5, 2007, at 8:26 AM, Jeff w

Downloading file from cgi application

2007-11-05 Thread sophie_newbie
Hi, I'm writing a cgi application in Python that generates a PDF file for the user and then allows them to download that file. Currently I'm just writing the PDF file to the 'htdocs' directory and giving the user a link to this file to download it. But the problem is that another user could simply

Re: Error when python script run as cgi script

2007-10-22 Thread sophie_newbie
On Oct 21, 7:28 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sun, 21 Oct 2007 09:50:54 -0700, sophie_newbie > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > > Hi, I'm running a python script which if I run from the command line > &

Error when python script run as cgi script

2007-10-21 Thread sophie_newbie
Hi, I'm running a python script which if I run from the command line as root runs fine. But if I run it through the web-browser as a cgi script gives the following error "Error in X11: unable to start device PNG". Now I should say that this python script is calling fucntions in R (a scripting lang

Dealing with "funny" characters

2007-10-20 Thread sophie_newbie
Hi, I want to store python text strings that characters like "é" "Č" in a mysql varchar text field. Now my problem is that mysql does not seem to accept these characters. I'm wondering if there is any way I can somehow "encode" these characters to appear as normal characters and then "decode" them

Stopping a fucntion from printing its output on screen

2007-10-17 Thread sophie_newbie
Hi, in my program i need to call a couple of functions that do some stuff but they always print their output on screen. But I don't want them to print anything on the screen. Is there any way I can disable it from doing this, like redirect the output to somewhere else? But later on in the program i

Setting a timeout for a cookie

2007-10-15 Thread sophie_newbie
Hi, I'm wondering how do you set a 'timeout' or expiry date/time for a cookie set using a python cgi script. I can set a cookie ok but I dunno how to set the expiry time so it always expires at the end of the session. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Create a string array of all comments in a html file...

2007-09-30 Thread sophie_newbie
Hi, I'm wondering how i'd go about extracting a string array of all comments in a HTML file, HTML comments obviously taking the format "". I'm fairly stumped on how to do this? Maybe using regular expressions? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Getting python script to write to input box on another window

2007-04-24 Thread sophie_newbie
Hi, I'm wondering if there is a way to get a python script to write text to an input box in a window of another program that is running? For example a text box in a web browser window? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting number of each item in a list.

2006-03-19 Thread sophie_newbie
Hi Paul, Ur bit of code works, thanks so much, just for anyone reading this use 'h = {}' instead of h = 0. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Counting number of each item in a list.

2006-03-19 Thread sophie_newbie
Hey Bruno, I got an invalid syntax error when i tried using your "str_counts = dict((s, str_list.count(s) for s in set(str_list))" bit of code? Maybe there is a missing bracket or comma? Or maybe I need to import something. Thanks so much for your help. -- http://mail.python.org/mailman/listinf

Counting number of each item in a list.

2006-03-19 Thread sophie_newbie
I have a list a little something like this: StringA StringC StringB StringA StringC StringD StringA ... etc. Basically I was wondering if there was an easy way to return how many of each string are in the list, something like this: StringA - 3 StringB - 1 StringC - 2 StringD - 1 I suppose that

Difference between a library and a module...

2006-03-07 Thread sophie_newbie
OK this might seem like a retarded question, but what is the difference between a library and a module? If I do: import string am I importing a module or a library? And if i do string.replace() am I using a module or a function or a method or what? Sorry. -- http://mail.python.org/mailman/li

Re: Strange behavior with os call in cgi script

2006-02-05 Thread sophie_newbie
OK, interesting, but just how dow I print he environment in the program?? -- http://mail.python.org/mailman/listinfo/python-list

Strange behavior with os call in cgi script

2006-02-05 Thread sophie_newbie
I have written a cgi script that seems to run perfectly from the command line when I simulate some cgi input using os.environ['QUERY_STRING']. The thing is that when I run it from the browser, one of my os.system calls, which gets excecuted fine when running the program in the interpreter, doesn't

Re: "Dynamic" website content

2006-01-29 Thread sophie_newbie
I am running apache on windows by the way. I think there may be issues with unbuffered output on windows... -- http://mail.python.org/mailman/listinfo/python-list

Re: "Dynamic" website content

2006-01-29 Thread sophie_newbie
To be honest that doesn't seem to work. Also it seems that only Mozilla based browsers support server push. Maybe it is something to do with how Apache is configured? Or is Python buffering the output? Is there a line of code to make python unbeffered? -- http://mail.python.org/mailman/listinfo

User login system

2006-01-28 Thread sophie_newbie
Can anyone recommend an open source user login system already written in Python that I could use with my site? Simplicity is the most important factor, but the ability to track users using cookies would be helpful. Hopefully somebody knows one? -- http://mail.python.org/mailman/listinfo/python-

Re: "Dynamic" website content

2006-01-22 Thread sophie_newbie
Flushing to stdout doesn't seem to work anyway. Honestly have no idea how you'd implement it in Javascript so might have an ask on one of their forums... -- http://mail.python.org/mailman/listinfo/python-list

Concatinating PDF files

2006-01-22 Thread sophie_newbie
I am converting TIFF images of patents to PDF files. Each patent comes in about 20 seperate TIFF images and I want to put them all in the one PDF file. Is there a way to do this? Using the Image library I think you can only convert individual TIFF images to PDF? Maybe there is a way of concatinati

Re: "Dynamic" website content

2006-01-21 Thread sophie_newbie
To give you a better explaination of what I want, you could visit www.pat2pdf.org. Type in 123456 as the patent number, you see what it does? It tells the user that it is requesting the various TIFF images and then displays the link to the PDF file that it has created. This is exactly what I want

"Dynamic" website content

2006-01-21 Thread sophie_newbie
Basically I have written a cgi script to automatically download TIFF images of patents from the US patent office. What I want is that the user can see what is happening when the images are being downloaded, because it takes a while to download them and there can be anything up to 30 individual fil

Re: Uncompressing TIFF files directly in Python

2006-01-18 Thread sophie_newbie
Ya that was the original plan but it didn't support the G4 compression of the tif files! I think the idea of using tiffcp is the best as it runs on both unix and windows which is what i need! -- http://mail.python.org/mailman/listinfo/python-list

Re: Uncompressing TIFF files directly in Python

2006-01-18 Thread sophie_newbie
Ya I did, sorry! -- http://mail.python.org/mailman/listinfo/python-list

Re: Uncompressing TIFF files directly in Python

2006-01-18 Thread sophie_newbie
I mainly just need it to work with windows and assumed that an os call would only work with windows! I've downloaded that free image software and the ctypes program, it seems to be working but I haven't yet worked out how to get it to decompress a G4 TIFF image... If anyone knows it would be of h

Uncompressing TIFF files directly in Python

2006-01-18 Thread sophie_newbie
Hey guys, OK this is a long shot but does anyone know of a way to uncompress tiff files directly in python. I know it can be done with an os call but that'll only work on unix and only if the right software is installed! I need to convert tiff images downloaded from uspto.gov to pdf, these images

Re: Converting TIFF files to PDF and/or JPEG

2006-01-18 Thread sophie_newbie
Hmm, does anyone know if there is a way to uncompress Tiff files in python itself without having to make an os call. This is because the script is kind of supposed to run on windows also... Sophie. -- http://mail.python.org/mailman/listinfo/python-list

Converting TIFF files to PDF and/or JPEG

2006-01-17 Thread sophie_newbie
Hey guys, As part of a college project I'm trying to write a script to convert TIFF images downloaded from the US patent office site, www.uspto.gov. The tiff images are encoded using CCITT Group 4 compression and appear to throw an error when i try to save them using the Image library: >>> im.sa

CGI question

2006-01-05 Thread sophie_newbie
I was wondering if there was a way to extract everyting in the url after the "?" question mark in one go. I have a search page and a results page, and I want the results page to be able to keep a history of what searches have been performed, but there is always a different number of search terms s

Passing cgi parameters to script...

2005-12-29 Thread sophie_newbie
Is there any way that I can pass cgi parameters to my script locally, before i upload it to the webserver, so that i can debug it. Normally I would pass parameters like this: www.webserver.com/script.cgi?TERM1=hello&FIELD1=TTL&TERM2=goodby&FIELD2=GOVT The problem is that I get errors that do not