Re: HTML expect in python
WGW wrote: > I would like to automate some simple browser navigating using python. > Ideally, I would like a package like pyexpect, but that can handle a > browser in much the same way as pyexpect handles a terminal (tall > order!). In short, I want a macro language for a browser (I know about > the commercial packages such as Easy Bee and Internet macros, but I want > more programmability and less cost!) > > http://pamie.sourceforge.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
Someone correct me if I'm wrong -- but isn't this the Shortest Path problem? I don't foresee anyone getting a more efficient solution than what they can find in hundreds of algorithms textbooks. If this is indeed the case it should just come down to whoever can pull the narliest tricks to create a fast python implementation of the algorithm. Brian Quinlan wrote: >I've decided that it would be be fun to host a weekly Python programming >contest. The focus will be on algorithms that require a bit of thought >to design but not much code to implement. > >I'm doing to judge the solutions based on execution speed. It sucks but >that is the easiest important consideration to objectively measure. I'll >also indicated which solutions I think are good examples of Python >design. Hopefully, people's solutions can provide a resource for people >looking for best practice examples and also for people looking for >performance ideas. > >You can find the first problem here: >http://www.sweetapp.com/pycontest/contest1 > >I'm always looking for feedback, so let me know what you think or if you >have any ideas for future problems. > >Cheers, >Brian > > > -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML expect in python
D H wrote: > See the mechanize module: http://wwwsearch.sourceforge.net/mechanize/ I second this, a very useful module. I've unfortunately had to change it a little to deal with inevitably bad HTML supplied by web sites. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list
Re: Snakespell
[EMAIL PROTECTED] wrote: > I used to use Snakespell from scriptfoundry to do spellchecking on my > website (www.peterbe.com/search?q=pyton) but now that I've moved server > and wiped the old machine I forgot to take with me the Snakespell code. > > www.scriptfoundry.com where it used to live seems to have expired. > > Does anybody know where I can get hold of this? (or even send a tgz to > me) PyEnchant is maintained and easy to use jsut anotehr suggestion. Regards, Fuzzyman http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
On Sat, 16 Jul 2005, Joseph Garvin wrote: > Someone correct me if I'm wrong -- but isn't this the Shortest Path problem? Dang! I was just about to point that out. > I don't foresee anyone getting a more efficient solution than what they > can find in hundreds of algorithms textbooks. If this is indeed the case > it should just come down to whoever can pull the narliest tricks to > create a fast python implementation of the algorithm. I guess part of the challenge is seeing through the description to the underlying problem - in this case, seeing that this can be cast as shortest-path. Not everyone would necessarily realise that! In particular, the fact that the available flights, and their prices, can be different on different days could well throw people. But yes, this is basically about who can write the fastest implementation of Dijkstra's algorithm. I've got one somewhere - i have a half-finished journey planner for the London Underground! - so maybe i should enter ... Hmm. Actually, Dijkstra's algorithm isn't always the fastest way to find the shortest path. The thing is, it's fully general, so it works on absolutely any graph; if the graph you're traversing has particular properties, you might be able to leverage those to find a solution faster. For instance, if your graph is a road network, you can put a lower bound on the distance from any vertex to the goal (being the straight-line distance between them - no path over actual roads can be any shorter than that), which allows you to do an A* search, which is a lot faster than Dijkstra. My own journey planner is also a case of this - i exploit various obvious properties of tube trains to avoid examining a large number of possible but daft travel plans. I can't immediately see any properties of this network that could be exploited, but that doesn't mean there aren't any. tom -- taxidermy, high tide marks, sabotage, markets, folklore, subverting, . -- http://mail.python.org/mailman/listinfo/python-list
Re: IDLE in Jython
Pippy looks pretty dead. Wasn't someone else working on a Palm port ? Best Regards, Fuzzyman http://www.voidspace.org.uk/python -- http://mail.python.org/mailman/listinfo/python-list
Re: Generating a list of None
[Bengt Richter] > how about (untested) > > def get_options(opts): > """Return True or False if an option is set or not""" > return [1 for val in vars(opts).values() if val is not None] and True or > False While we're tossing around hacks and coding atrocities, we should note that: not not x outperforms: x and True or False neither of which is as clear as: bool(x) Raymond -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Wow, that was the most thorough answer to a comp.lang.python question since the Martellibot got busy in the search business. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Newbie
The usual order I recommed is ... http://honors.montana.edu/~jjc/easytut/easytut/ http://www.ibiblio.org/obp/thinkCSpy/ http://docs.python.org/tut/tut.html Ron's list is quite a good place for tutorials http://www.awaretek.com/tutorials.html -- http://mail.python.org/mailman/listinfo/python-list
secure uploading
hi i'm after a way to securely upload a file to a web server and I'm wondering how to go about it. basically i want to upload a small text file to my hosted webspace once every hour or so. because it will be happening once an hour, i want to make sure the transaction is encrypted, but i don't really know how to do this. can someone point me in the right direction? i'm a reasonably noob scripter so go easy on me. :) thanks! -h. -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I send keystrokes to a console window in Windows XP?
[EMAIL PROTECTED] wrote: > How do I use Python to send keystrokes to a console window in Windows > XP? import win32com.client shell = win32com.client.Dispatch("WScript.Shell") shell.AppActivate("Command Prompt") shell.SendKeys("cls{ENTER}") shell.SendKeys("dir{ENTER}") shell.SendKeys("echo Hi There{ENTER}") -- Benji York -- http://mail.python.org/mailman/listinfo/python-list
Re: HTML expect in python
Thanks for these replies -- looks like I have all I need; now it is just a question of getting my head around the applications and doing some testing... Many thanks for pointers. -- http://mail.python.org/mailman/listinfo/python-list
Re: ssh popen stalling on password redirect output?
[EMAIL PROTECTED] wrote: > In general, it is good idea to use expect kind of tool to deal with > interactive programs like ssh. You may try using pexpect > (http://pexpect.sourceforge.net). > I tried tha once (on Solaris) and found that ssh could tell that pexpect wasn't a real tty and refused to connect. In the end, I had pexpect do a telnet 127.0.0.1, log in, then so ssh to the real destination. Pain in the ass but it worked. The Cog -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Bengt Richter wrote: > >>> identity = ''.join([chr(i) for i in xrange(256)]) > >>> unprintable = ''.join([c for c in identity if c not in string.printable]) And note that with Python 2.4, in each case the above square brackets are unnecessary (though harmless), because of the arrival of "generator expressions" in the language. (Bengt knows this already, of course, but his brain is probably resisting the reprogramming. :-) ) -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
"Tom Anderson" <[EMAIL PROTECTED]> wrote: > On Sat, 16 Jul 2005, Joseph Garvin wrote: > > > Someone correct me if I'm wrong -- but isn't this the Shortest Path problem? > > Dang! I was just about to point that out. > > [snipped] > > But yes, this is basically about who can write the fastest implementation > of Dijkstra's algorithm. I've got one somewhere - i have a half-finished > journey planner for the London Underground! - so maybe i should enter ... > > Hmm. Actually, Dijkstra's algorithm isn't always the fastest way to find > the shortest path. The thing is, it's fully general, so it works on > absolutely any graph; if the graph you're traversing has particular > properties, you might be able to leverage those to find a solution faster. > [snipped] Yes, that's right. Moreover, Dijkstra's computes the shortest path from a given start to *all* nodes in the network, which is usually an overkill if all you want is the shortest path to one (or a few) node(s). > I can't immediately see any properties of this network that could be > exploited, but that doesn't mean there aren't any. Hints: - You have to take exactly one decision (flight or stop) every single day until you reach the destination; no more, no less. - There is no time machine; days pass in one direction only, one at a time. George -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
On Sat, 16 Jul 2005 10:25:29 -0400, Peter Hansen wrote: > Bengt Richter wrote: >> >>> identity = ''.join([chr(i) for i in xrange(256)]) >> >>> unprintable = ''.join([c for c in identity if c not in >> string.printable]) > > And note that with Python 2.4, in each case the above square brackets > are unnecessary (though harmless), because of the arrival of "generator > expressions" in the language. But to use generator expressions, wouldn't you need an extra pair of round brackets? eg identity = ''.join( ( chr(i) for i in xrange(256) ) ) with the extra spaces added for clarity. That is, the brackets after join make the function call, and the nested brackets make the generator. That, at least, is my understanding. -- Steven who is still using Python 2.3, and probably will be for quite some time -- http://mail.python.org/mailman/listinfo/python-list
Re: problems with python 2.4 help
ipython and pyshell? http://www.onlamp.com/pub/a/python/2005/01/27/ipython.html http://www.wxpython.org/PyManual.html -- http://mail.python.org/mailman/listinfo/python-list
odd python/linux/cherrypy behavior
On my laptop, I have an NTFS partition for NT, a FAT partition for data as a dmz which both linux and NT can access, and an ext3 partition for linux. However, I've experienced some weirdness on the FAT partition, and I'm wondering if anybody can tell me why it's happening. Yesterday, I downloaded the new release of cherrypy, and stuck it on the dmz drive. I ran tutorial01, which opens up a server on port 8080 and waits for connections. All seemed well, initialization info printed out, and it said it was waiting for connections on port 8080. However, when I tried to connect to it (via firefox or telnet) it just didn't respond. Not immediately - the connection attempts timed out. I tried different ports, but that didn't change anything. A reboot into NT, run the same file, it works perfectly. Eventually, after thinking it's a hosts file problem, or a firewall problem, I figure out that if I move it to my ext3 drive, it again works perfectly. Prints out the same information, says it's waiting on 8080, but this time, I can access it. Can anybody posit a guess as to why it would behave this way? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: What module to use to get a file from a website?
curl and wget are the most robust ways to do this http://cool.haxx.se/mailman/listinfo/curl-and-python http://www.gnu.org/software/wget/wget.html -- http://mail.python.org/mailman/listinfo/python-list
python certification
i want to get a small certificate or diploma in python. it should be online cuz i live in pakistan and wont have teast centers near me. it should be low cost as i am not rich. and hopefully it would be something like a a begginer certification cuz i am new to python. -- http://mail.python.org/mailman/listinfo/python-list
Re: secure uploading
"macaronikazoo" <[EMAIL PROTECTED]> writes: > i'm after a way to securely upload a file to a web server and I'm > wondering how to go about it. basically i want to upload a small text > file to my hosted webspace once every hour or so. because it will be > happening once an hour, i want to make sure the transaction is > encrypted, but i don't really know how to do this. can someone point > me in the right direction? Use SSL/TLS. It's not a scripting thing, just set up your server to enable encryption. If you use apache, http://modssl.org might get you started. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
"Tom Anderson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sat, 16 Jul 2005, Joseph Garvin wrote: > >> Someone correct me if I'm wrong -- but isn't this the Shortest Path >> problem? > > Dang! I was just about to point that out. One twist is that it is not the shortest path to one node or all nodes but to a set of nodes (the destination on any of several days). > I can't immediately see any properties of this network that could be > exploited, but that doesn't mean there aren't any. No it doesn't. The challenge is to find a property that saves more time, across trials, that it takes to compute. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list
Parsing html :: output to comma delimited
Hello All, I am a total python newbie, and I need help writing a script. This is what I want to do: There is a list of links at http://www.rentalhq.com/fulllist.asp. Each link goes to a page like, http://www.rentalhq.com/store.asp?id=907%2F272%2D4425, that contains a company name, address, phone, and fax. I want extract each page, parse this information, and export it to a comma delimited text file, or tab delimited. The important information in each page is: United Rentals Inc. 3401 Commercial Dr. Anchorage AK, 99501-3024 http://maps.google.com/maps?q=3401+Commercial+Dr%2E Anchorage AK 99501-3024 "> Phone - 907/272-4425 Fax - 907/272-9683 So from that I want output like : United Rentals Inc.,3401 Commercial Dr.,Anchorage,AK,"995013024","9072724425","9072729683" or United Rentals Inc. 3401 Commercial Dr. Anchorage AK 995013024 9072724425 9072729683 I have been messing around with beautiful soup (http://www.crummy.com/software/BeautifulSoup/index.html) but haven't gotten very far. (specially because the html is so sloppy) Any help would be really appreciated! Just point me in the right direction, what to use, examples... Thanks! -Sam -- http://mail.python.org/mailman/listinfo/python-list
Re: How can I import a py script by its absolute path name?
"J.Bijsterbosch" <[EMAIL PROTECTED]> writes: > Hmm, what you call special treatment comes from pythons deep underlying C > and C++ language heietidge I presume. A backslash in a C or C++ string means > the following character is a so called escape character, like \n represents > a newline and \r a return to the beginning of a line. > If you really want a backslash you need to type it twice like so \\. Has > nothing to do with Windows...;-)) Yes, I'm well aware of that. However, you can say that using '\' as a path separator needs special treatment, because it is conventionally treated as an escape character. Moreover, I wans't the one asking for information, I have privilidge to use real operating systems as a programming platform. Thanks for enthsiasm, though :) -- # Edvard Majakari Software Engineer # PGP PUBLIC KEY available Soli Deo Gloria! You shouldn't verb verbs. -- http://mail.python.org/mailman/listinfo/python-list
Re: Django - Rails killer comes...
I can't wait to try this out. We'll see how it stacks up next to ROR. "JZ" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > http://www.djangoproject.com/ > > -- > JZ -- http://mail.python.org/mailman/listinfo/python-list
Re: Debugger Confusion
By now, you have probably found an IDE that gives you satisfactory debugging. I think your original problem was trying to use an emacs shell (M-x shell) to run Python interpreter. But the emacs Python mode works a whole better than Python in a dumb terminal. Have you tried the following? -- open Python source file in emacs -- expect to see that the buffer is in Python mode, so when you select it, "Python" appears on the modeline and the emacs menu bar, and describe-mode gives mucho info. -- from the emacs Python menu (or Xemacs right click to get Python popup), select "Start interpreter", or just C-c ! keys. -- again from Python source buffer, selectPython "Execute buffer" or C-c C-c keys. -- if the source has pdb.set_trace() as previous post suggested, the interpreter buffer will stop there, and in fact pdb.py will appear in another emacs buffer. -- in the interpreter, type n Enter --now you'll see the desired pointer in a temp copy of your Python source or whatever imported Python library you find yourself. With emacs/Python syntax highlighting (M-x font-lock-fontify-buffer), it's not bad. The one true editor is always worth the effort :) HTH. "Rex Eastbourne" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > One thing: is it possible to go through the code within emacs? Doing it > on the command line is useful, but it would be very helpful if I could > have a little marker within the emacs buffer that showed me where I am. > > Rex > -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Steven D'Aprano wrote: > On Sat, 16 Jul 2005 10:25:29 -0400, Peter Hansen wrote: >>Bengt Richter wrote: >> >>> >>> identity = ''.join([chr(i) for i in xrange(256)]) >> >>And note that with Python 2.4, in each case the above square brackets >>are unnecessary (though harmless), because of the arrival of "generator >>expressions" in the language. > > But to use generator expressions, wouldn't you need an extra pair of round > brackets? > > eg identity = ''.join( ( chr(i) for i in xrange(256) ) ) Come on, Steven. Don't tell us you didn't have access to a Python interpreter to check before you posted: c:\>python Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 >>> ''.join(chr(c) for c in range(65, 91)) 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' -Peter -- http://mail.python.org/mailman/listinfo/python-list
SSL problem... SSL23_GET_SERVER_HELLO:unknown protocol
Morning. I've been running into an error message pertaining to SSL that I don't understand, and I was hoping someone had some insight. Gmail provides POP access over SSL on port 587, so I tried to use poplib.POP_SSL, with the following results: %python Python 2.4.1 (#1, May 16 2005, 15:19:29) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from poplib import POP3_SSL >>> pop= POP3_SSL('pop.gmail.com', 587) Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/poplib.py", line 359, in __init__ self.sslobj = socket.ssl(self.sock, self.keyfile, self.certfile) File "/usr/lib/python2.4/socket.py", line 74, in ssl return _realssl(sock, keyfile, certfile) socket.sslerror: (1, 'error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol') >>> Any suggestions or insight? -- http://mail.python.org/mailman/listinfo/python-list
Re: Generating a list of None
On 16 Jul 2005 02:31:28 -0700, "Raymond Hettinger" <[EMAIL PROTECTED]> wrote: >[Bengt Richter] >> how about (untested) >> >> def get_options(opts): >> """Return True or False if an option is set or not""" >> return [1 for val in vars(opts).values() if val is not None] and True >> or False > >While we're tossing around hacks and coding atrocities, we should note >that: > > not not x > >outperforms: > > x and True or False > >neither of which is as clear as: > > bool(x) > Point. ;-) (I actually thought to do not not x and bool(x) also crossed my mind, so I'm not sure why I wound up with the above). BTW, I imagine this is probably faster (and closer to the OP's approach), at least for large option sets: (maybe needs comment like # not all None's ? ;-) >>> def get_options(opt): ... values = vars(opt).values() ... return values.count(None) != len(values) ... >>> opt = type('',(),{})() >>> get_options(opt) False >>> opt.a=None >>> get_options(opt) False >>> opt.b=None >>> get_options(opt) False >>> opt.c = 'option c' >>> get_options(opt) True >>> vars(opt) {'a': None, 'c': 'option c', 'b': None} Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
ANN: MyNewspaper-1.0
Hi there, I'm really pleased to announce the first public release of MyNewspaper. MyNewspaper is a personal RSS Aggregator and Reader, licensed under GPL. Why? As everybody says, I couldn't find any which fulfills all my requirements. In fact I used liferea and was pretty happy with it, but it eats lot of memory when you have many feeds and the program is running for much time, but the main problem was that it's a desktop program and I couldn't read the feeds from the work. So I started writing my own RSS aggregator and reader. MyNewspaper is written in Python with a bit of javascript and uses sqlite as permanent storage for the articles. It is installed as a CGI, so in order to use and manage it you need a web browser and a web server. Feeds are updated by a command run by cron or from the WebUI. Read more and download it from: http://inigo.katxi.org/devel/mynewspaper or http://www.terra.es/personal7/inigoserna/mynewspaper Of course, all comments, suggestions etc. are welcome. And yes, I know code is really awful now, but I wanted to make a public release to get some feedback while improving the code. Best regards, -- Iñigo Serna <[EMAIL PROTECTED]> Katxijasotzaileak signature.asc Description: This is a digitally signed message part -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
On Sat, 16 Jul 2005 10:25:29 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >Bengt Richter wrote: >> >>> identity = ''.join([chr(i) for i in xrange(256)]) >> >>> unprintable = ''.join([c for c in identity if c not in >> string.printable]) > >And note that with Python 2.4, in each case the above square brackets >are unnecessary (though harmless), because of the arrival of "generator >expressions" in the language. (Bengt knows this already, of course, but >his brain is probably resisting the reprogramming. :-) ) > Thanks for the nudge. Actually, I know about generator expressions, but at some point I must have misinterpreted some bug in my code to mean that join in particular didn't like generator expression arguments, and wanted lists. Actually it seems to like anything at all that can be iterated produce a sequence of strings. So I'm glad to find that join is fine after all, and to get that misap[com?:-)]prehension out of my mind ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
"Terry Reedy" <[EMAIL PROTECTED]> wrote: > "Tom Anderson" <[EMAIL PROTECTED]> wrote: > > I can't immediately see any properties of this network that could be > > exploited, but that doesn't mean there aren't any. > > No it doesn't. The challenge is to find a property that saves more time, > across trials, that it takes to compute. There could have been one if the schedule was fixed across trials. However, if you look into the test script, this is not the case; a new schedule is randomly generated every time. So any heavy preprocessing on the schedule is rather unlikely to pay off. George -- http://mail.python.org/mailman/listinfo/python-list
Re: Django - Rails killer comes...
On Sat, 2005-07-16 at 03:26 +0200, JZ wrote: > http://www.djangoproject.com/ Hey, that is crazy shit! I really like the concept and will give it a try ASAP! I have searched for something like this some month ago but ended my search at ROR. I am not a python hacker but i know how to use it and i hope i will become better when trying this software. Thanks for your _open_ release! I love it! Regards, -- Johannes Findeisen http://hanez.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
"Bengt Richter" <[EMAIL PROTECTED]> wrote: > >>> identity = ''.join([chr(i) for i in xrange(256)]) > >>> unprintable = ''.join([c for c in identity if c not in string.printable]) Or equivalently: >>> identity = string.maketrans('','') >>> unprintable = identity.translate(identity, string.printable) George -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
George Sakkis wrote: > "Bengt Richter" <[EMAIL PROTECTED]> wrote: >> >>> identity = ''.join([chr(i) for i in xrange(256)]) > > Or equivalently: identity = string.maketrans('','') Wow! That's handy, not to mention undocumented. (At least in the string module docs.) Where did you learn that, George? -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
On Sat, 16 Jul 2005 19:01:50 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >George Sakkis wrote: >> "Bengt Richter" <[EMAIL PROTECTED]> wrote: >>> >>> identity = ''.join([chr(i) for i in xrange(256)]) >> >> Or equivalently: >identity = string.maketrans('','') > >Wow! That's handy, not to mention undocumented. (At least in the >string module docs.) Where did you learn that, George? > http://python.org/doc/lib/node109.html >-Peter >-- >http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs. Access VBA
On Fri, 2005-07-15 at 23:19 -0400, William Lodge wrote: > I'm at a loss on how to compare Python vs. Access VBA for a database > project. I'm estimating 20 tables and several forms and reports. Some of the > tables could grow to many thousands of rows w/i a year or so. The app would > be resident on my client as no network connectivity is needed b/c I'll be > the only user. I'd probably use Access tables for now and plan on scaling up > to Oracle later if necessary (which it probably won't be). Move to Oracle is no problem at all. With Access you could connect to all RDMS that is providing an ODBC driver. In Python you could connect to all Databases you find a class for. Maybe you should take a look at ADOdb [1]. > If the project is successful, it may be adopted in the division. There is no > time limit but this is being done on my own time, and my guestimate for a > practical limit would be 3-4 months. I'm not a developer but have done > programming in the academic world as part of MSIS degree. I also want the > app to have a GUI. The GUI is set up very fast in Access and in Glade [4]. No difference in the speed. > I'm currently reviewing Wingware's Python product. Will review Komodo next. > It doesn't appear that the Wingware product has a GUI builder, but Komodo's > Pro version does (although more costly). Anybody have any recommendations in > this regard? Any thoughts as to whether implementing in Python would be any > harder or easier to do than in Access? Access is click and go but definitely NO freedom. Access has many features but you cant trust them. I have developed a big Access application some years ago and i will never do that gain. You're maybe faster when using Access but, is faster better? If you have enough knowledge of Python you will be as fast as in Access too. Python delivers nearly all features for _real_ application development and when you're a using some of the very hot classes around the web you could nearly do everything with Python. When you are using Komodo, you're in a environment like Access but since i remember you have an interface for using Python. Maybe you should give it try. I think there is a free version with less feature available. > Finally, does anybody know of any Web sites having examples of database apps > in Python? Well, give TinyERP a try [2]. It is a very clean and nice written Python application using the GTK [3] Toolkit for the GUI. That's what other people are using for rapid application development in UNIX environments. The GUI could easy be created using the Glade interface designer and all codework is Python. You don't have to bother about the GUI in the code and you have a dynamically generated GUI at program execution. This makes it easy to change the GUI layout without touching the code. Signal handling is also implemented and very easy to use. Glade and GTK+ are available for Windows operating systems too. Some Links: 1. http://adodb.sourceforge.net/ 2. http://tinyerp.org/ 3. http://pygtk.org/ 4. http://glade.gnome.org/ My recommendation: Use Python! You will love me in some years because i have said this. When using Access you are binding your application to Microsoft. You need a runtime version of Access when distributing the application to others. When using Python you could build an install CD for more the windows and you didn't have to bother about proprietary licensing issues. Good Luck with your decision... ;-) Regards, -- Johannes Findeisen http://hanez.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: odd python/linux/cherrypy behavior
Bill Mill: > ... a FAT partition for data as a dmz which both linux and NT can > access ... > Yesterday, I downloaded the new release of cherrypy, and stuck it on > the dmz drive. ... > Eventually, after thinking it's a hosts file problem, or a firewall > problem, I figure out that if I move it to my ext3 drive, it again > works perfectly. Have you looked at your mount options to make sure they are sane? Possibly you have mounted with only short (truncated) file names or all the files have their execute bit on and that is unexpected or there are non-ASCII characters in file names or ... Neil -- http://mail.python.org/mailman/listinfo/python-list
Re: Parsing html :: output to comma delimited
samuels <[EMAIL PROTECTED]> wrote: > Hello All, > > I am a total python newbie, and I need help writing a script. > > This is what I want to do: > > There is a list of links at http://www.rentalhq.com/fulllist.asp. Each > link goes to a page like, > http://www.rentalhq.com/store.asp?id=907%2F272%2D4425, that contains a > company name, address, phone, and fax. I want extract each page, parse > this information, and export it to a comma delimited text file, or tab > delimited. The important information in each page is: > > style="border-collapse: collapse" bordercolor="#11" width="100%" > id="AutoNumber1"> > > > > United Rentals Inc. > > > 3401 Commercial Dr. > Anchorage AK, 99501-3024 > > > href="http://maps.google.com/maps?q=3401+Commercial+Dr%2E Anchorage AK > 99501-3024 "> > > border="0"> > > > > > > > > > Phone - 907/272-4425 > Fax - 907/272-9683 > > So from that I want output like : > > United Rentals Inc.,3401 Commercial > Dr.,Anchorage,AK,"995013024","9072724425","9072729683" > > or > > United Rentals Inc. 3401 Commercial > Dr. Anchorage AK 995013024 9072724425 9072729683 > > > I have been messing around with beautiful soup > (http://www.crummy.com/software/BeautifulSoup/index.html) but haven't > gotten very far. (specially because the html is so sloppy) > > Any help would be really appreciated! Just point me in the right > direction, what to use, examples... Thanks! I'm sure others will give proper Python solution. But, here, shell is not a bad tool. lynx -dump 'http://www.rentalhq.com/store.asp?id=907%2F272%2D4425' | \ awk '/Return to List of Rental Stores/,/To reserve an item/' | \ sed -n -e '3p;5p;10p;11p' gives me United Rentals Inc. 3401 Commercial Dr. Anchorage AK, 99501-3024 Phone - 907/272-4425 Fax - 907/272-9683 -- William Park <[EMAIL PROTECTED]>, Toronto, Canada ThinFlash: Linux thin-client on USB key (flash) drive http://home.eol.ca/~parkw/thinflash.html BashDiff: Super Bash shell http://freshmeat.net/projects/bashdiff/ -- http://mail.python.org/mailman/listinfo/python-list
Re: odd python/linux/cherrypy behavior
On 7/16/05, Neil Hodgson <[EMAIL PROTECTED]> wrote: > Bill Mill: > > > ... a FAT partition for data as a dmz which both linux and NT can > > access ... > > Yesterday, I downloaded the new release of cherrypy, and stuck it on > > the dmz drive. ... > > Eventually, after thinking it's a hosts file problem, or a firewall > > problem, I figure out that if I move it to my ext3 drive, it again > > works perfectly. > > Have you looked at your mount options to make sure they are sane? > Possibly you have mounted with only short (truncated) file names or all > the files have their execute bit on and that is unexpected or there are > non-ASCII characters in file names or ... > Definitely not mounted with short file names, and there aren't any non-ASCIIs in the file names; in both cases I imagine that the file wouldn't run at all. In this case, however, the file does run, and open a socket, it just can't seem to receive connections on it. I have tried running the file as su, with no success. The FAT dirs are mounted with the following options: defaults,user,umask=000 . I'm not sure what you mean by the execute bit, but all files do have execute permission. Here's the output of an ls -l on the file I'm talking about: -rwxrwxrwx 1 root root 1073 2005-07-15 21:40 /d/download/cherrypy/tutorial/tut01_helloworld.py Any other ideas? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Programming Contest
On Sat, 16 Jul 2005, George Sakkis wrote: > "Tom Anderson" <[EMAIL PROTECTED]> wrote: > >> On Sat, 16 Jul 2005, Joseph Garvin wrote: >> >>> Someone correct me if I'm wrong -- but isn't this the Shortest Path >>> problem? >> >> Dang! I was just about to point that out. >> >> [snipped] >> >> But yes, this is basically about who can write the fastest >> implementation of Dijkstra's algorithm. I've got one somewhere - i have >> a half-finished journey planner for the London Underground! - so maybe >> i should enter ... >> >> Hmm. Actually, Dijkstra's algorithm isn't always the fastest way to >> find the shortest path. The thing is, it's fully general, so it works >> on absolutely any graph; if the graph you're traversing has particular >> properties, you might be able to leverage those to find a solution >> faster. [snipped] > > Yes, that's right. Moreover, Dijkstra's computes the shortest path from > a given start to *all* nodes in the network, which is usually an > overkill if all you want is the shortest path to one (or a few) node(s). Actually, it only computes shortest paths from the source to every node which is closer than the destination. Unless you keep computing after you've found your route! >> I can't immediately see any properties of this network that could be >> exploited, but that doesn't mean there aren't any. > > Hints: > > - You have to take exactly one decision (flight or stop) every single > day until you reach the destination; no more, no less. > > - There is no time machine; days pass in one direction only, one at a time. Ah, but in my approach, those rules are encoded in the structure of the graph; i don't think they leave you with a graph with any obvious exploitable properties. To expand on that, rather than making a graph in which vertices are cities and edges are services, which then leaves me with the headache of finding a route in the face of shifting availability and weight of edges, i make each vertex a spacetime, rather than a purely spatial, location - 'Frankfurt on friday', for example, would be a different vertex to 'Frankfurt on monday'. Flights are then simply edges which link the origin city on the day they depart to the destination city on the next day; their weight is the cost of the flight. City X on day N is always linked to City X on day N+1 by an edge representing the option of staying in a hostel. Vertices corresponding to the destination city on any day are all linked to a special goal vertex by length-0 edges, so if you can make it to the destination at any time, you win. You could put nonzero weights on those edges if you liked, to capture your preferences about when you wanted to arrive (if you were willing to pay 15 pounds more to get there on tuesday, you'd set the weight of links from tuesday to the goal to -15, for example). You'd probably also want a special start node linked to your home airport on every day by length-0 edges. I can't see any properties of the resulting graph that are particularly interesting. The fact that flight prices are not correlated with physical distance makes an A*-like approach impossible. Actually, there is one thing - the number of edges you need to traverse to get from any vertex to any other (apart from the start and goal vertices) is always the same, regardless of the route taken, since each edge corresponds to one day's actions, and any given pair of vertices are a certain number of days apart. Ah, is that what you were hinting at? I'm still not sure how you could use this, though! tom -- I do not think we will have to wait for very long. -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Jp Calderone wrote: > On Sat, 16 Jul 2005 19:01:50 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: >> George Sakkis wrote: >> identity = string.maketrans('','') >> >> Wow! That's handy, not to mention undocumented. (At least in the >> string module docs.) Where did you learn that, George? >> > http://python.org/doc/lib/node109.html Perhaps I was unclear. I thought it would be obvious that I knew where to find the docs for maketrans(), but that the particular behaviour shown (i.e. arguments of '' having that effect) was undocumented in that page. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
"Peter Hansen" <[EMAIL PROTECTED]> wrote: > Jp Calderone wrote: > > On Sat, 16 Jul 2005 19:01:50 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote: > >> George Sakkis wrote: > >> identity = string.maketrans('','') > >> > >> Wow! That's handy, not to mention undocumented. (At least in the > >> string module docs.) Where did you learn that, George? > >> > > http://python.org/doc/lib/node109.html > > Perhaps I was unclear. I thought it would be obvious that I knew where > to find the docs for maketrans(), but that the particular behaviour > shown (i.e. arguments of '' having that effect) was undocumented in that > page. > > -Peter Actually I first read about this in the Cookbook; there are two or three recipes related to string.translate. As for string.maketrans, it doesn't do anything special for empty string arguments: maketrans( from, to) Return a translation table suitable for passing to translate() or regex.compile(), that will map each character in from into the character at the same position in to; from and to must have the same length. So if from and to are empty, maketrans will map zero characters, hence the identity. It's not the only way to get the identity translation table by the way: >>> string.maketrans('', '') == string.maketrans('a', 'a') == >>> string.maketrans('hello', 'hello') True George -- http://mail.python.org/mailman/listinfo/python-list
Re: odd python/linux/cherrypy behavior
Bill Mill: > Definitely not mounted with short file names, and there aren't any > non-ASCIIs in the file names; in both cases I imagine that the file > wouldn't run at all. In this case, however, the file does run, and > open a socket, it just can't seem to receive connections on it. I have > tried running the file as su, with no success. Works for me as root or unprivileged user using CherryPy-2.1.0-beta. > The FAT dirs are mounted with the following options: > defaults,user,umask=000 . From fstab: /dev/hda6 /winvfatutf8,shortname=winnt You may have some file content transformation such as \r\n->\n translation (conv=text) occurring. > I'm not sure what you mean by the execute > bit, but all files do have execute permission. Here's the output of an > ls -l on the file I'm talking about: > > -rwxrwxrwx 1 root root 1073 2005-07-15 21:40 > /d/download/cherrypy/tutorial/tut01_helloworld.py -rwxr-xr-x 1 root root 1074 Jun 26 17:28 tut01_helloworld.py Here is the output from the run [EMAIL PROTECTED] tutorial]# python tut01_helloworld.py 2005/07/17 11:01:33 CONFIG INFO Reading infos from configFile: tutorial.conf 2005/07/17 11:01:33 CONFIG INFO Server parameters: 2005/07/17 11:01:33 CONFIG INFO server.environment: production 2005/07/17 11:01:33 CONFIG INFO server.logToScreen: True 2005/07/17 11:01:33 CONFIG INFO server.logFile: 2005/07/17 11:01:33 CONFIG INFO server.protocolVersion: HTTP/1.0 2005/07/17 11:01:33 CONFIG INFO server.socketHost: 2005/07/17 11:01:33 CONFIG INFO server.socketPort: 8080 2005/07/17 11:01:33 CONFIG INFO server.socketFile: 2005/07/17 11:01:33 CONFIG INFO server.reverseDNS: False 2005/07/17 11:01:33 CONFIG INFO server.socketQueueSize: 5 2005/07/17 11:01:33 CONFIG INFO server.threadPool: 10 2005/07/17 11:01:33 HTTP INFO Serving HTTP on socket: ('', 8080) 2005/07/17 11:01:56 HTTP INFO 127.0.0.1 - GET / HTTP/1.1 2005/07/17 11:01:56 HTTP INFO 127.0.0.1 - GET /favicon.ico HTTP/1.1 Neil -- http://mail.python.org/mailman/listinfo/python-list
Re: secure uploading
well I want a script to upload something automatically, so i need a python script to do that for me. my hoster has ssl enabled on their server and I have generated a key. but now I need to know how to upload something using ssl to the server. how to I ftp something to the server using ssl? thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: secure uploading
"macaronikazoo" <[EMAIL PROTECTED]> writes: > well I want a script to upload something automatically, so i need a > python script to do that for me. my hoster has ssl enabled on their > server and I have generated a key. but now I need to know how to > upload something using ssl to the server. how to I ftp something to > the server using ssl? Ftp is not usually done over ssl. Usually you'd use http over ssl. -- http://mail.python.org/mailman/listinfo/python-list
Re: secure uploading
ok, so what can I do to get something uploaded? how can I upload something via http? -- http://mail.python.org/mailman/listinfo/python-list
Re: Parsing html :: output to comma delimited
Pyparsing includes a sample program for extracting URLs from web pages. You should be able to adapt it to this problem. Download pyparsing at http://pyparsing.sourceforge.net -- Paul -- http://mail.python.org/mailman/listinfo/python-list
Re: Python vs. Access VBA
On Sun, 2005-07-17 at 01:30 +0200, Johannes Findeisen wrote: > My recommendation: > > Use Python! You will love me in some years because i have said this. > When using Access you are binding your application to Microsoft. You > need a runtime version of Access when distributing the application to > others. When using Python you could build an install CD for more the > windows and you didn't have to bother about proprietary licensing > issues. P.S.: Before i forget: MS-Access doesn't care about security in any way. In Python you need to implement most features by yourself but you have the ability. In MS-Access you must trust Microsoft! This is the truth... Regards, -- Johannes Findeisen http://hanez.org/ -- http://mail.python.org/mailman/listinfo/python-list
Re: secure uploading
"macaronikazoo" <[EMAIL PROTECTED]> writes: > ok, so what can I do to get something uploaded? how can I upload > something via http? Depends on your web host. At worst, use a server side script to accept the upload. You're asking basic webmaster-type questions. This really isn't the best place for those. -- http://mail.python.org/mailman/listinfo/python-list
Re: secure uploading
oh ok cool. I'll ask them for some advice. thanks! -- http://mail.python.org/mailman/listinfo/python-list
Re: odd python/linux/cherrypy behavior
On 7/16/05, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Sat, 16 Jul 2005 19:54:31 -0400, Bill Mill <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > > The FAT dirs are mounted with the following options: > > defaults,user,umask=000 . I'm not sure what you mean by the execute > > bit, but all files do have execute permission. Here's the output of an > > ls -l on the file I'm talking about: > > > > -rwxrwxrwx 1 root root 1073 2005-07-15 21:40 > > /d/download/cherrypy/tutorial/tut01_helloworld.py > > > Out of curiosity, is it possible to change ownership to your > "user" account? > Thanks a lot, that worked. Any guess as to why? Peace Bill Mill bill.mill at gmail.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
George Sakkis wrote: > "Peter Hansen" <[EMAIL PROTECTED]> wrote: Where did you learn that, George? > > Actually I first read about this in the Cookbook; there are two or three > recipes related to string.translate. As for string.maketrans, it > doesn't do anything special for empty string arguments: ... I guess so. I was going to offer to suggest a new paragraph on that usage for the docs, but as you and Jp both seem to think the behaviour is obvious, I conclude "it's just me" so I suppose I shouldn't bother. -Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: What module to use to get a file from a website?
from os import system system ("start http://www.python.org/";) -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
"Peter Hansen" <[EMAIL PROTECTED]> wrote: > George Sakkis wrote: > > "Peter Hansen" <[EMAIL PROTECTED]> wrote: > Where did you learn that, George? > > > > Actually I first read about this in the Cookbook; there are two or three > > recipes related to string.translate. As for string.maketrans, it > > doesn't do anything special for empty string arguments: ... > > I guess so. I was going to offer to suggest a new paragraph on that > usage for the docs, but as you and Jp both seem to think the behaviour > is obvious, I conclude "it's just me" so I suppose I shouldn't bother. It's only obvious in the sense that _after_ you see this idiom, you can go back to the docs and realize it's not doing something special; OTOH if you haven't seen it, it's not at all the obvious solution to "how do I get the first 256 characters". So IMO it should be mentioned, given that string.translate often operates on the identity table. I think a single sentence is adequate for the reference docs. George -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
On Sat, 16 Jul 2005 16:42:58 -0400, Peter Hansen wrote: > Steven D'Aprano wrote: >> On Sat, 16 Jul 2005 10:25:29 -0400, Peter Hansen wrote: >>>Bengt Richter wrote: >>> >>> identity = ''.join([chr(i) for i in xrange(256)]) >>> >>>And note that with Python 2.4, in each case the above square brackets >>>are unnecessary (though harmless), because of the arrival of "generator >>>expressions" in the language. >> >> But to use generator expressions, wouldn't you need an extra pair of round >> brackets? >> >> eg identity = ''.join( ( chr(i) for i in xrange(256) ) ) > > Come on, Steven. Don't tell us you didn't have access to a Python > interpreter to check before you posted: Er, as I wrote in my post: "Steven who is still using Python 2.3, and probably will be for quite some time" So, no, I didn't have access to a Python interpreter running version 2.4. I take it then that generator expressions work quite differently than list comprehensions? The equivalent "implied delimiters" for a list comprehension would be something like this: >>> L = [1, 2, 3] >>> L[ i for i in range(2) ] File "", line 1 L[ i for i in range(2) ] ^ SyntaxError: invalid syntax which is a very different result from: >>> L[ [i for i in range(2)] ] Traceback (most recent call last): File "", line 1, in ? TypeError: list indices must be integers In other words, a list comprehension must have the [ ] delimiters to be recognised as a list comprehension, EVEN IF the square brackets are there from some other element. But a generator expression doesn't care where the round brackets come from, so long as they are there: they can be part of the function call. I hope that makes sense to you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
On Sat, 16 Jul 2005 19:01:50 -0400, Peter Hansen wrote: > George Sakkis wrote: >> "Bengt Richter" <[EMAIL PROTECTED]> wrote: >>> >>> identity = ''.join([chr(i) for i in xrange(256)]) >> >> Or equivalently: >identity = string.maketrans('','') > > Wow! That's handy, not to mention undocumented. (At least in the > string module docs.) Where did you learn that, George? I can't answer for George, but I also noticed that behaviour. I discovered it by trial and error. I thought, oh what a nuisance that the arguments for maketrans had to include all 256 characters, then I wondered what error you would get if you left some out, and discovered that you didn't get an error at all. That actually disappointed me at the time, because I was looking for behaviour where the missing characters weren't filled in, but I've come to appreciate it since. -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Re: Filtering out non-readable characters
Replying to myself... this is getting to be a habit. On Sun, 17 Jul 2005 15:08:12 +1000, Steven D'Aprano wrote: > I hope that makes sense to you. That wasn't meant as a snide little dig at Peter, and I'm sorry if anyone reads it that way. I found myself struggling to explain simply the different behaviour between list comps and generator expressions, and couldn't be sure I was explaining myself as clearly as I wanted. It might have been better if I had left off the "to you". -- Steven -- http://mail.python.org/mailman/listinfo/python-list
Python HTTP digest authentication woes...
I'm trying to access the XML version of my Tivo now playing list with python. It uses auth digest HTTP authentication. I could really use some help! I'm able to get this page using curl: curl --dump-header tivoHeaders --insecure --anyauth --user tivo:808 "https://192.168.1.102/TiVoConnect?Command=QueryContainer&Container=%2FNowPlaying&Recurse=Yes"; But when I use my python script, I get rejected: https://192.168.1.102/TiVoConnect?Container=%2FNowPlaying&Command=QueryContainer&Recurse=Yes Error 401 Server: tivo-httpd-1:7.1b-01-2:140 Set-Cookie: sid=DEC2D78EABF48A6D; path=/; expires="Saturday, 16-Feb-2013 00:00:00 GMT"; WWW-Authenticate: Digest realm="TiVo DVR", nonce="FD08EF226909CA85", qop="auth" Content-Length: 31 Content-Type: text/html Connection: close Digest realm="TiVo DVR", nonce="FD08EF226909CA85", qop="auth" I've scrounged for examples out there and the couple that I've found just don't seem to work for me.. Here's one way I've tried: = import urllib2 theurl = "192.168.1.102/TiVoConnect?Container=%2FNowPlaying&Command=QueryContainer&Recurse=Yes" print theurl protocol = 'https://' username = 'tivo' password = '808' passman = urllib2.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, theurl, username, password) authhandler = urllib2.HTTPDigestAuthHandler(passman) opener = urllib2.build_opener(authhandler) urllib2.install_opener(opener) try: pagehandle = urllib2.urlopen(protocol + theurl) except IOError, e: if hasattr(e, 'code'): if e.code != 401: print 'We got another error' print e.code else: print "Error 401" print e.headers print e.headers['www-authenticate'] === I get 401 every time! This was taken from an example online almost verbatim, the only major thing I changed was HTTPBasicAuthHandler --> HTTPDigestAuthHandler. Any ideas or help would be greatly appreciated! Thanks, -John -- http://mail.python.org/mailman/listinfo/python-list