| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Comments:
<0> I -am- a newbie when it comes to writing network type stuff. <1> it may be overkill, but you could also look at twisted <0> I originally wrote the app only with sockets. <0> But the networking bits are a bit shoddy so I wanted to upgrade everything. <0> Yeah. I've looked at Twisted. <0> It looks nice functionality-wise. But I'd prefer to only use parts of the standard library. <1> FWIW, there has been a fair amount of talk of deprecated asyncore at some unspecified future point <1> *deprecating <0> Hmmm...really... <2> why? <0> I wasn't aware of that. <2> its useful. <1> the thought would be to replace it with a small subset of Twisted, possibly <2> no way mcmillen <1> see http://www.python.org/dev/summary/2004-11-01_2004-11-15.html -- there are more recent threads (2005) discussing it as well <3> jimbug: well, if you aren't familiar with select/poll stuff, you could look at the source code of asyncore itself for an example usage :)
<4> i'm having real trouble getting python to see svn. i have installed svn with swig bindings - do i need to do anything more on the python sside to get it to see svn ? <5> kbingham: Where did you install the svn module? A typical cause is having multiple versions of Python installed <5> kbingham: So find the directory with svn.so, or whatever it is called. Check the sys.path in your python. is the diretory there? <4> i'm quite sure i've only got the one version of python on - jsut installed 2.4.2 <4> just running find | grep svn.so <2> ignacio, <2> i fixed the .py problem <6> Not really. <5> kbingham: Well, the module may not be called that. Look at when you did python setup.py install to see what it installed and where <2> ignacio, well, it opens up in gedit now anyways <4> erwin: is that a setup.py for subversion ? <5> kbingham: a setup.py for Python is the equivalent of ./configure for C programs. It uses distutils to install a module. <4> i've run python setup.py install for sqllite but not svn :) i'm guessing thats gonna be where my problem is :) <5> Depends on what the svn python module is installed by <5> BTW, on this system I run apt-get install python2.4-svn to install the SVN Python module <4> i'm on slack 10.2 <4> no apt-get afaik:) <7> How to check if a variable has a sequence type? <5> Depends on how permissive you want to be. <5> You could try iterating over it for example, or indexing it. <7> I want an argument that can be one scalar, or some sequence of scalars. <8> I need a little tutoring over here, I'm using this example http://fragments.turtlemeat.com/pythonwebserver.php as my basic http server, and I want to output variables from a simple script to it, but the script is a while loop... so it blocks execution of any response from the webserver <4> effectively i'm trying to get trac running so i'm following http://projects.edgewall.com/trac/wiki/TracInstall <8> is there a way to start it as a subprocess or something so I can p*** vars to it, but the while doesn't block it from running properly? <5> halley: Note though that strings are sequences too. <7> Erwin, yeah, this is ints. <9> halley, why do you want that? <5> halley: So you could also explicitly check for type, i.e. using if isinstance(foo, (int, long, float)): ... <5> halley: Alternatively you could declare your function as foo(*arg) and then could call it as foo(1) or foo(1,2,3) <9> Either require a sequence and let people write (5,) if they only want one, or provide two functions, one for a single scalar and one for a sequence <9> Magic is usually not a good idea <7> Erwin, the latter looks better. <10> does any one take part of developpement of an open source ERp called TinyErp <11> wots an erp? <7> Brend, even the creator of python things (5,) is ****ing ugly. <7> thinks <9> I think so too, but at least it's explicit <5> halley: note that that works best if you call your function with literal arguments. If you then need to p*** it a list you got from somewhere else, you'll need fun(*theList) to expand it into arguments <10> dobson, http://tiny.be/ <9> dobson: Something for which large companies pay vast sums of money to be gradually destroyed <7> Erwin, I see. I know it's not like perl where lists are distinct from arrays, and that's a good example of it. <10> Brend, yeah it's a way to view the thing :) <5> halley: In Python, everything is a reference and references are automatically dereferenced <8> I want to output variables from a simple script to a built in webserver, but the script is a while loop... so it blocks execution of any response from the webserver, can I make a subprocess or something so that the while loop is not blocking the operation of the webserver? <5> What is it doing in the loop? <8> Running a pygame display window that updates a timer <1> try looking into module "subprocess" or os.popen* <9> Or Twisted! <5> rofl-waffle: Well, maybe pygame lets you integrate its loop with events from web servers <5> rofl-waffle: But yeah, I think twisted has a pygame loop <8> oh ok, thanks for the pointers, I'll go try and figure it out :) <5> So with twisted you could -- for almost free -- get a web server, ssh server, ftp server and name server integrated into your app <9> I am terrified of any game which includes a nameserver : ) <1> me too :) <12> I guess a game with a ssh server is more scary <5> Well, if it was a MMORPG you could use it to give each player his own subdomain :-) <9> Die <13> you too , hi :) <14> I'd like to get the best textual representation of current function/method in the code. What should I call to get it? <5> Define textual representation <5> And what's the purpose of this?
<15> which module provides a method for getting the size of a directory? <1> tuxipuxi: os.listdir? <5> There's nothing like "du" <15> oh <5> If you want to add up the sizes of all files, you'll need either os.listdir and os.path.getsize, or os.walk <5> The latter if you want recursion <15> so best way is to use popen and get the output of du? <1> depends on what you mean by "best" <14> Erwin: method M of cl*** C wants to syslog the message "Packet loss", so it calls log("C:M:: Packet loss"). I wish the log "header" -- C:M:: -- to be dynamically retrieved by some call so I do not need to rewrite the log messages when adapting the code to different methods. <1> less portable, but far easier to code, yes <2> stain, Are you there? <2> stain, Please say you are :P <15> mcmillen: yes doesn't have to be portable, just needs to run on linux <2> question. <1> then popening du is probably easiest <5> Tuttle_: check out sys._getframe() then, but that's an internal C Python function <2> what things could i even use the call stack for <2> Erwin, inspect.getstack is better <2> er <2> inspect.stack <1> traceback.extract_Stack <14> I just found out that inspect.currentframe() returns the same object as what you're proposing now. <5> >>> inspect.currentframe is sys._getframe <5> True <14> :) <15> mcmillen: ok thanks <2> Tuttle_, inspect.stack(2)[0] == inspect.currentframe(), methinks <1> use inspect or traceback.. got a great idea to use functions that start with _, as they may go away or change interface on you <1> *got->not <2> not* <2> yeah :P <5> tuttle_: Are you going to disappear among a small tornado of newspapers now? <2> Erwin, very funny. <14> Erwin: I'm going to disappear and never existed even when I'm given a medal. ;-) <16> are there any source-level debuggers for python that look more like the visual studio debugger? <4> do i have to make / install SWIG separatly or does it come with python / svn / <16> e.g. with a window where you can add variables to watch <1> it's separate <17> hi <4> is there an easy way to see if i've already got it installed? <4> its not a command as such is it - more of a library <17> I have a strange sort problem <5> kbingham: It's a separate package <17> i know there is function called sort() which takes even a function which tells it how to compare <4> ok - just downloaded - gonna install it now <5> kbingham: It's a generic tool for wrapping all sorts of C/C++ libraries to Python , Perl and many other languages, so it's not Python specific <17> the compare function needs 3 return values -1,0,1 <17> and 2 arguments <2> luh: yes <5> luh: If you are using python 2.4, it is far better to use the key argument instead. <5> luh: e.g. l.sort(key = lambda x: x.someAttributeToSortOn) <2> Erwin, what is that? <17> the problem i have is that my compare function doesn't know yet how it is supposed to sort, but gets the information during the running of the program <17> (it should be able to sort in different ways) <17> but i have no clue how to do that <5> luh: You can either make a function that checks that how to sort varialbe and acts differently, or several specialized functions if there are only two ways <5> def sortSomething(): ... <5> def key(item): if sortOnFoo: return item.foo else: return item.bar <5> l.sort(key) <5> well, l.sort(key = key) <17> ? <17> i want to sort objects from a cl*** <17> this cl*** has 4 values it can be sorted on <5> And? No matter where you are doing this from, your compare or key function should find the sorting key from somewhere and apply it <5> If the values are attributes, the sorting key could be the name of the attribute <5> e.g. l.sort(key = lambda x: getattr(x, self.sortingKey)) <5> where you before did a self.sortingKey = 'name' or 'age' or whatever <18> I'm trying to make a cl*** that extends __builtin__.str, with keyword arguments in the __init__() method, but it is complaining about "'gapsize' is an invalid keyword argument for this function" -- is this a problem in the way I'm defining the method or a way I'm calling it? <5> LazloFruvous: You'll need to override __new__ <18> Erwin: oh...why? <18> I've never extended a built-in type before... are there some docs about it? <5> LazloFruvous: Immutability of string objects <17> Erwin, - it sorts 4 values default would be style, artist, album, title (it's a tag cl***) <14> Ok, but I still can't get the cl*** name from the frame...
Return to
#python or Go to some related
logs:
#web #physics kubuntu #gentoo sauron isc oid
#linux CentOS memory issues fc5 raidtab
ca-42 linux ubuntu #css
|
|