Re: Can't create list of dictionaries
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 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 1000 times! > > I've tried using dict.copy() on the dictionary that was returned from > the function but this didn't work either. > > And the function is definately returning different dictionaries each > time as I can see that when I print them. > > I know this is something to do with the dictionries being stored as > references but I've no idea how to fix it seeing as the copy() > function didn't work. > > Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Can't create list of dictionaries
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 1000 times! I've tried using dict.copy() on the dictionary that was returned from the function but this didn't work either. And the function is definately returning different dictionaries each time as I can see that when I print them. I know this is something to do with the dictionries being stored as references but I've no idea how to fix it seeing as the copy() function didn't work. Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Best way to spawn process on back end computer
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 "best" way to go about this. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Reporting the line number of an exception
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 help! -- http://mail.python.org/mailman/listinfo/python-list
Re: Setting expirty data on a cookie
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 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? > > > You're probably looking for cookielib.Cookie > > I don't think so, to give you a more complete picture, if I run this > code: > > import Cookie > import time > c = Cookie.SimpleCookie() > c['data'] = "unamepwordwhatever" > c.expires = time.time() + 300 > print c > > This codes gives an output of: > > "Set-Cookie: data=unamepwordwhatever" > > As in there is no mention of an expiry date, when surely there should > be? > > Thanks for any advice. Ok this seems to work: import Cookie import time c = Cookie.SimpleCookie() c['data'] = "unamepwordwhatever" c['data']['expires'] = 30 * 24 * 60 * 60 print c Gives an output of: "Set-Cookie: data=unamepwordwhatever; expires=Sat, 24-May-2008 12:11:36 GMT" Bizarre that this information was so hard to find! -- http://mail.python.org/mailman/listinfo/python-list
Re: Setting expirty data on a cookie
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() > > 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? > > You're probably looking for cookielib.Cookie I don't think so, to give you a more complete picture, if I run this code: import Cookie import time c = Cookie.SimpleCookie() c['data'] = "unamepwordwhatever" c.expires = time.time() + 300 print c This codes gives an output of: "Set-Cookie: data=unamepwordwhatever" As in there is no mention of an expiry date, when surely there should be? Thanks for any advice. -- http://mail.python.org/mailman/listinfo/python-list
Re: Spawing a thread and printing dots until it finishes
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 spawned is finished. > > Code is > > something like this: > > > import threading > > class MyThread ( threading.Thread ): > > def run ( self ): > > myLongCommand()... > > > import time > > > t = MyThread() > > t.start() > > > while t.isAlive(): > > print "." > > time.sleep(.5) > > > print "OK" > > > The thing is this doesn't print a dot every half second. It just > > pauses for ages until the thread is finished and prints prints ".OK". > > But if I take out the "time.sleep(.5)" line it will keep printing dots > > really fast until the thread is finished. So it looks like its the > > time.sleep(.5) bit that is messing this up somehow? > > > Any ideas? > > > Thanks! > > As it happens I've managed to come up with a solution to this problem > using a subprocess rather than a thread. Its not exactly rocket > science but I thought I'd post it anyway. There are 3 files: > > ## dots.py ### > # a script to print a dot every half second until it is terminated > > import time > import sys > > while 1 == 1: > > sys.stdout.write(".") > sys.stdout.flush() > > time.sleep(.5) > > # PrintDots.py ## > > # This is a simple class to spawn off another process that prints dots > repeatedly on screen > # when printDots() is called and stops when stopDots is called. It is > useful in cgi-scripts > # where you may want to let the user know that something is happening, > rather than looking > # at a blank screen for a couple of minutes. > > import time > import subprocess > import os > from signal import SIGTERM > > class PrintDots: > > # the constructor, called when an object is created. > def __init__(self): > > self.pid = 0 > > # the location of the script that prints the dots > self.dotsScript = "dots.py" > > def printDots(self): > > self.pid = subprocess.Popen( [ "python", self.dotsScript] > ).pid > > def stopDots(self): > > os.kill(self.pid, SIGTERM) > > mainFile.py ## > # The above can then be called from any cgi-script as follows > > from PrintDots import PrintDots > p = PrintDots() > p.printDots() > print "Doing R Stuff" > my_Call_To_R_That_Takes_A_Long_Time() > p.stopDots() > print "OK" > > > > And low and behold dots are printed on screen every half second while > python is talking to R, with an output like this: > > Doing R Stuff.OK Whoops that last bit of code should read as follows: from PrintDots import PrintDots p = PrintDots() print "Doing R Stuff" p.printDots() my_Call_To_R_That_Takes_A_Long_Time() p.stopDots() print "OK" -- http://mail.python.org/mailman/listinfo/python-list
Re: Spawing a thread and printing dots until it finishes
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 > class MyThread ( threading.Thread ): > def run ( self ): > myLongCommand()... > > import time > > t = MyThread() > t.start() > > while t.isAlive(): > print "." > time.sleep(.5) > > print "OK" > > The thing is this doesn't print a dot every half second. It just > pauses for ages until the thread is finished and prints prints ".OK". > But if I take out the "time.sleep(.5)" line it will keep printing dots > really fast until the thread is finished. So it looks like its the > time.sleep(.5) bit that is messing this up somehow? > > Any ideas? > > Thanks! As it happens I've managed to come up with a solution to this problem using a subprocess rather than a thread. Its not exactly rocket science but I thought I'd post it anyway. There are 3 files: ## dots.py ### # a script to print a dot every half second until it is terminated import time import sys while 1 == 1: sys.stdout.write(".") sys.stdout.flush() time.sleep(.5) # PrintDots.py ## # This is a simple class to spawn off another process that prints dots repeatedly on screen # when printDots() is called and stops when stopDots is called. It is useful in cgi-scripts # where you may want to let the user know that something is happening, rather than looking # at a blank screen for a couple of minutes. import time import subprocess import os from signal import SIGTERM class PrintDots: # the constructor, called when an object is created. def __init__(self): self.pid = 0 # the location of the script that prints the dots self.dotsScript = "dots.py" def printDots(self): self.pid = subprocess.Popen( [ "python", self.dotsScript] ).pid def stopDots(self): os.kill(self.pid, SIGTERM) mainFile.py ## # The above can then be called from any cgi-script as follows from PrintDots import PrintDots p = PrintDots() p.printDots() print "Doing R Stuff" my_Call_To_R_That_Takes_A_Long_Time() p.stopDots() print "OK" And low and behold dots are printed on screen every half second while python is talking to R, with an output like this: Doing R Stuff.OK -- http://mail.python.org/mailman/listinfo/python-list
Re: Spawing a thread and printing dots until it finishes
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 ): > > def run ( self ): > > myLongCommand()... > > > import time > > > t = MyThread() > > t.start() > > > while t.isAlive(): > > print "." > > time.sleep(.5) > > > print "OK" > > > The thing is this doesn't print a dot every half second. It just > > pauses for ages until the thread is finished and prints prints ".OK". > > But if I take out the "time.sleep(.5)" line it will keep printing dots > > really fast until the thread is finished. So it looks like its the > > time.sleep(.5) bit that is messing this up somehow? > > We know that your main routine gives up the processor but without a > full definition of MyThread how do we know that it ever does? I > suspect that it hits sleep once, if at all, and then goes to the final > print statement. In fact, I suspect that this is not exactly what you > tried anyway. This code would not have printed ".OK" whether it > entered the loop or not. It could have printed this; > > . > OK > > because the print statement in the loop will print a dot on a line by > itself. > > When looking for these sorts of answers you should really try to create > a smallest program that exhibits the behaviour you are questioning and > then cut and paste the entire script into your message unedited. Often > enough you will even answer your own question in the process. > > -- > D'Arcy J.M. Cain <[EMAIL PROTECTED]> | Democracy is three > wolveshttp://www.druid.net/darcy/ | and a sheep voting on > +1 416 425 1212 (DoD#0082)(eNTP) | what's for dinner. "myLongCommand()... " is a call to an function in R (the statistical programming language) via Rpy (A python module that allows calls to R). The call takes a couple of minutes to execute. I'm trying to build a web front end to this R function and instead of the user looking at a blank screen for 2-3 mins, I want to print dots to let them feel like the program isn't hanging. What I am saying is that without the "time.sleep(.5)" line, the above code will print dots on the screen continuously for 2-3 mins, filling it up with a ridiculous ammount of dots. Whereas with the time.sleep line, instead of pausing for half a second between dots, its seems to print, as you correctly pointed out: . OK With a pause of 2-3 minutes between the . and the OK. I hope that clears things up a little. I haven't the faintest idea why the code above doesn't work but hope someone has an idea. It wouldn't be something to do with python not being able to handle multiple threads at the same time or something? I hope there is a workaround. -- http://mail.python.org/mailman/listinfo/python-list
Setting expirty data on a cookie
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? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Spawing a thread and printing dots until it finishes
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 = MyThread() t.start() while t.isAlive(): print "." time.sleep(.5) print "OK" The thing is this doesn't print a dot every half second. It just pauses for ages until the thread is finished and prints prints ".OK". But if I take out the "time.sleep(.5)" line it will keep printing dots really fast until the thread is finished. So it looks like its the time.sleep(.5) bit that is messing this up somehow? Any ideas? Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem setting cookie in Internet Explorer
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 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 suspicion that it could be something to do with > > the expiry time of the cookie. But I'm really not sure and don't > > really know where to go with it. I've tried it on Internet Explorer on > > 2 machines and get the same problem. > > > Thanks for any help... > > Did you make sure cookies are enabled in Internet Explorer? > > You might also take a look at these pages: > > http://www.voidspace.org.uk/python/articles/cookielib.shtmlhttp://www.voidspace.org.uk/python/recipebook.shtml#cookielib > > They seem quite informative. > > Mike Ya cookies are def enabled, will check that out thanks! -- http://mail.python.org/mailman/listinfo/python-list
Problem setting cookie in Internet Explorer
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 suspicion that it could be something to do with the expiry time of the cookie. But I'm really not sure and don't really know where to go with it. I've tried it on Internet Explorer on 2 machines and get the same problem. Thanks for any help... -- http://mail.python.org/mailman/listinfo/python-list
Re: Copy Stdout to string
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 > also... > > Thanks! I found this, it pretty much does the job, easily modified to write to a variable instead of a file: http://www.answermysearches.com/python-how-to-print-to-screen-and-a-file-at-the-same-time/52/ -- http://mail.python.org/mailman/listinfo/python-list
Copy Stdout to string
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...
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 on completion of the very long task. The script executing the very long task will then email the user on completion. So far I have something like this (leaving out the obvious)... CGI script: pid = subprocess.Popen(["python", "spawn.py"]).pid print "Thanks you will be emailed on completion" Spawn.py script: doVeryLongCalc() emailUser() Basically the problem with this is that the cgi script page in the browser keeps on acting as if its loading until the Spawn.py script is finished executing. Somehow apache "knows" that the spawned process is still running in the background. So I'm basically asking if I can somehow spawn a script that will be completely independent of its parent script? So Apache doesn't know its running and the page finishes loading? Thanks if anyone can help... -- http://mail.python.org/mailman/listinfo/python-list
Re: Keep a python script running after browser window closed
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 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 don't know how to keep the code running in the > > background. I'm sure there is a smart way to do this... > > > Thanks! > > You might have your cgi script use the subprocess module to open a > second script that does the long-running process. > > Mike Ya it looks like: import subprocess # spawn subprocess subprocess.Popen(["python", "spawn.py"]) Should do this job, where spawn.py is the script to do the job. Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Keep a python script running after browser window closed
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 don't know how to keep the code running in the background. I'm sure there is a smart way to do this... Thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: Create thumbnail image (jpg/png) of PDF file using Python
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 imageMagick. Good stuff so it is. -- http://mail.python.org/mailman/listinfo/python-list
Create thumbnail image (jpg/png) of PDF file using Python
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
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 wrote: > > > Store the file in a database. When an authorized user clicks the > > link, send the proper headers ('Content-Type: application/pdf') and > > then print the file. > > > -- > >http://mail.python.org/mailman/listinfo/python-list Thanks alot, you guys sure know your stuff! -- http://mail.python.org/mailman/listinfo/python-list
Downloading file from cgi application
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 come along and download a file that isn't their file by typing the address into the address bar. I don't want to delete the file after it is downloaded either because I'd like the user to be able to download it again if necessary. Is there any way around this problem? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Error when python script run as cgi script
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 > > 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 languange used in statistics) using the python module RPy, > > so this I dunno if this is entirely a Python question, because as far > > as I can see the error is being thrown by R. But then as I say, when > > the script is run by the root user from the command line everything > > goes off without a hitch. > > Ah, but does it run if you boot into a NON-graphical command shell > mode... > > That error message looks suspiciously like something is trying to > open a graphical display window... A web-server likely does not have any > graphical environment. > -- > WulfraedDennis Lee Bieber KD6MOG > [EMAIL PROTECTED] [EMAIL PROTECTED] > HTTP://wlfraed.home.netcom.com/ > (Bestiaria Support Staff: [EMAIL PROTECTED]) > HTTP://www.bestiaria.com/ Ya thanks looks like you're actually right. The strange thing is that the program, when run from a graphical command line, doesn't actually open any display window. Although the code doesn't run when executed as a webserver, most likely, as you pointed out, because there is no graphical environment. I wonder if there any way I can somehow enable a graphical environment for the webserver, or do I have to re-write the underlying code? -- http://mail.python.org/mailman/listinfo/python-list
Error when python script run as cgi script
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 languange used in statistics) using the python module RPy, so this I dunno if this is entirely a Python question, because as far as I can see the error is being thrown by R. But then as I say, when the script is run by the root user from the command line everything goes off without a hitch. So I dunno is there some way to run a CGI script as root, maybe thats a bad idea because of security? But any ideas would be welcome. -Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Dealing with "funny" characters
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 when I want to get them out of the database again? -Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Stopping a fucntion from printing its output on screen
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 then need to print other stuff so i'd need to re-enable printing too. Any ideas? -- http://mail.python.org/mailman/listinfo/python-list
Setting a timeout for a cookie
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...
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
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.
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.
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/listinfo/python-list
Counting number of each item in a list.
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 the easiest way to do that is to convert it to a 2 dimensional array? Is there any easy way? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Difference between a library and a module...
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/listinfo/python-list
Re: Strange behavior with os call in cgi script
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
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 seem to get excecuted, or gets excecuted but does nothing. Does anyone know whats going on or how I could debug this problem? It is worth noting that other os.system calls in the script get excecuted fine. -- http://mail.python.org/mailman/listinfo/python-list
Re: "Dynamic" website content
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
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/python-list
User login system
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-list
Re: "Dynamic" website content
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
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 concatinating these files or maybe there is a way to create the PDF from the TIFFs in the first place? -- http://mail.python.org/mailman/listinfo/python-list
Re: "Dynamic" website content
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 to do, so if anyone has any idea how it is done I would be greatful. I'm not asking how to get the TIFF files of create the PDF etc, that is grand, just how it updates the screen with its progress like that... -- http://mail.python.org/mailman/listinfo/python-list
"Dynamic" website content
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 files for each image. Is there a way of using Python or any other means, that I could it could print on the webpage: Downloading image 1 Downloading image 2 ... Downloading image X as the individual pictures are being downloaded so the user doesn't think the program is hanging? -- http://mail.python.org/mailman/listinfo/python-list
Re: Uncompressing TIFF files directly in Python
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
Ya I did, sorry! -- http://mail.python.org/mailman/listinfo/python-list
Re: Uncompressing TIFF files directly in Python
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 help? -- http://mail.python.org/mailman/listinfo/python-list
Uncompressing TIFF files directly in Python
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 are compressed using G4, so I dunno if anyone knows of a method of doing this witout the os call! Surely there is a utility out there somewhere? Sophie -- http://mail.python.org/mailman/listinfo/python-list
Re: Converting TIFF files to PDF and/or JPEG
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
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.save(outfile, "PDF) It looks like this odd compression format is not supported, or am i wrong? I know its a long shot but would anyone have a different solution? Sophie. -- http://mail.python.org/mailman/listinfo/python-list
CGI question
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 so there is always a differnet number of parameters, ie. localhost/cgi-bin/results.cgi?TERM1=hello&FIELD1=3&TERM2=python&FIELD2=43&&TERM3=Yallo&FIELD3=21. Is there any easy way of getting the results.cgi program to read this entire URL (or even just the bit after the question mark) or is it a case of writing a comlex bit of code to extract the parameters one by one and create the URL that way? -- http://mail.python.org/mailman/listinfo/python-list
Passing cgi parameters to script...
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 show up when I run the script locally and I do not have access to the error logs. So is there a way I can pass the form values TERM1, FIELD1 etc to the script without having to upload it to the server? -- http://mail.python.org/mailman/listinfo/python-list