@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24



Comments:

<0> i'd like to create a script that fetches some data from links on some page, is there alredy a lib simmilar to the task i need?
<1> there are at least a couple
<1> a quick google seach turns up http://zesty.ca/python/scrape.py
<1> there is a "browser emulator" module that will handle cookies and stuff like that as well, i am trying to fin dit
<2> azi`: check out beautifulsoap
<1> http://www.crummy.com/software/BeautifulSoup/
<1> http://wwwsearch.sourceforge.net/mechanize/
<0> beautiful soap looks complicated
<3> hullo
<1> hello
<3> I have a question, what does this mean: AttributeError: musicsync instance has no attribute '__getitem__'
<3> musicsync is a cl*** that I've written
<4> x = musicsync()
<3> ...?
<4> hasattr(x, '__getitem__') # False



<1> it probably means you said ms[whatever] when musicsync can't handle that
<3> aha
<1> you need a __getitem__ cl*** to handle indexing an object with the square brackets
<1> sorry, methods
<1> method
<3> I just realised I was being stupid
<3> I was doing ms = musicsync()
<3> then trying to access ms['item']
<3> when I should have done output = ms.function
<3> then output['item']
<3> What would you say is the "best" GUI toolkit if I want to make a simple program that is cross platform Unix/Windows?
<3> I'm looking at wxWidgets at the mo...
<1> wx is nice
<1> tkinter will work if its simple... it comes with activepython also which is nice
<3> well, it's not THAT simple
<3> how simple would it have to be?
<1> tkinter is fully functional
<1> its just a little slow and could be better
<1> you probably want wx
<1> wxpython
<3> yeah
<5> hmmm
<5> how do i access functions written in C/++ dlls?
<1> use ctypes
<5> which is
<5> what exactly? :P
<1> ... a module for accessing object code in dlls...
<5> well gee could you be more specific than that
<6> google for ctypes
<5> kay
<1> thats not specific?
<1> jeez
<7> how can i get command line arguments in a python script?
<1> sys.argv
<1> its a list of the args
<7> cool
<1> starting with the invoked program name as sys.argv[0]
<7> that doesn't make sense
<7> shouldn't that return python?
<1> actually i think it returns the name of the script p***ed on the python command line
<7> so if you did something like
<1> and under unix you can construct the .py file so it's directly executable
<7> python script -a
<7> ['script', '-a'] would be the list returned?
<5> joe_k, thats the traditional, but not mandatory
<1> try it out and see
<7> okay
<5> joe_k, its chosen by the calling application, like all argv[] values are ;p
<6> you might want to check out the optparse module, too
<1> yeah ;)
<7> this doesn't seem right
<1> storage0 ~ $ python test.py lskdjf lsdkjf lsjkdf
<1> ['test.py', 'lskdjf', 'lsdkjf', 'lsjkdf']
<7> yeah, i got that...not very friendly on the repl
<8> Hello.
<1> hello
<9> Azi: I'm investigating this matter too, this whole midday and afternoon I have delved into xml parsers
<7> and while we are on the subject...how do you construct the .py file so its directly executable.... #!/usr/bin/python
<7> or something like that?
<1> yes
<1> and chmod +x it



<7> but isn't it likely that other distros use other paths to store python?
<1> possibly
<7> how do you account for that?
<1> some people use #!/usr/bin/env python
<8> How can I find the 'type' of a file from python other than by running the program 'file' (ugly) ?
<10> Bison: #!/usr/bin/env python should work on most unices
<7> i see
<7> back to reading then
<7> thanks for the support
<8> is there a library implementing what the program 'file' does ?
<1> there are bindings to libmagic
<11> Pupeno: python-magic package in Debian.
<1> i think zope has some mimetype-guessing module
<8> Erwin: thanks.
<8> Erwin: something non-Debian specific ? I am running Ubuntu and I don't have python-magic, taking a look at python-magic of debian it seems it is build out of the file package ? does file itself contain python bindings ?
<2> Pupeno: python2.4-magic
<7> so how do i make do i exit from a script
<1> sys.exit(0)
<7> cool
<1> or let it run off the end (which i prefer)
<6> ahmeni: only in dapper
<8> ahmeni: I am aware of those packages (...2.4...); but that packages is not available on either Ubuntu stable nor Debian stable. Maybe it is a recent addition to file.
<8> indeed it is.
<1> looks like libmagic is for handling the 'magic' file anyway, not identifying other files
<7> um, those repos are usually way out of date anyways
<1> i.e. find uses it to load the identification rules
<2> you could try parsing it manually, or installing the .deb by hand
<1> http://svn.zope.org/zope.mimetype/trunk/src/zope/mimetype/typegetter.txt?rev=40747&view=markup
<1> theres zope's module
<1> if you download zope you can probably extract it out
<1> (for guessing file types)
<12> trying turbogears; setting up postgre database; command: tg-admin sql create; error: psycopg.OperationalError: fe_sendauth: no p***word supplied
<8> ahmeni: I am recompiling the newest file for breezy.
<1> ltbarcly: supply a p***word
<12> I've been trying to determine how to set the p***word in postgre, or will the script do this for me?
<1> or maybe setup pg_hba.conf (i think?) to trust connections from wherever you are connecting to the db server from
<12> I realize this is a probably a silly question, but I'm pretty worthless on DBs
<13> ltbarcly: sqlobject.dburi="postgres://user:p***word@host/dbname"
<12> ahh
<12> I was trying to set the p***word in SQL, but of course the DB isn't created yet
<12> so I had no idea
<1> hold on, do you want to change what the DB thinks the user's p***word is, or do you want to tell your script how to connect with that p***word?
<1> does it require a p***word from psql command line
<12> ahh
<12> I think the tutorial ***umes you have postgres up and running
<13> Yes it does
<12> hmm, does it use postgre for foreign keys? or can you substitute sqlite
<12> TML: does it use postgre for foreign keys? or can you substitute sqlite
<13> ltbarcly: I don't understand the question
<12> does it matter which database is used? I'm sorry if I'm asking stupid questions
<13> Not to TurboGears, it doesn't.
<12> ahh, thank you
<13> ltbarcly: Note that there is a #turbogears
<12> ty
<7> is there a way to get a list of variables and functions in the current environment?
<1> dir()
<7> and by environment i mean the python repl
<7> with no args?
<1> when you say repl you mean read eval print loop, but in python that term tends to mean the method that returns an object's canonical representation
<1> FYI
<11> Err, that's repr :-)
<1> damnit
<14> can I use compiled python with mod_python please ?
<1> sorry
<14> nobody answers me on #python.web
<1> 12 hour day
<11> Spending too much time with the Japanese? :-)
<11> "compiled python" ?
<14> bytecode
<14> .pyc files
<7> joe_k: huh, well that confuses things doesn't it
<11> Generally, mod_python is good for nothing. Switch to e.g. Turbogears or Django as soon as you can.
<1> bison: disregard


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #python
or
Go to some related logs:

kubuntu using lilo
#php
gnome-btdownload resume
#perl
squash sb_bread error
kubuntoo
#python
#ubuntu
#math
driver nw122nxt01



Home  |  disclaimer  |  contact  |  submit quotes