| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Comments:
<0> I suspect -d val does too. <1> I keep getting confused when to use PyFoo and _PyFoo and Py_Foo <2> optparse? is that a standard module? <0> http://www.python.org/doc/2.4.2/ext/backToExample.html <0> timonator: Yes <0> Use it <0> :p <2> okay <0> It's awesome-ish <0> cout: I use the Py_RETURN_NONE macro. <0> That's why I never saw this. <0> If you have a C function that returns no useful argument (a function returning void), the corresponding Python function must return None. You need this idiom to do so (which is implemented by the Py_RETURN_NONE macro): <0> Mention of the macro is the only was this 2.4 doc differs from the 2.3 doc. <0> I suspect this is done simply to be technically correct. <0> And that is doesn't really matter. <0> But, it's in a macro, so I just do it.
<1> cosmint: ah, I didn't know about that <2> youre right, it IS awesome-ish <0> parser = OptionParser(usage='usage: %prog [options] srcpath1 srcpath2 ..etc..',version="060126.1") <0> parser.add_option('-n','--network',action='store_true',dest='network',help='Specify when transferring over network. (default)') <0> parser.add_option('-l','--local',action='store_false',dest='network',help='Specify when transferring files locally.') <0> parser.add_option('--broot',dest="broot",help="Specify explicit backup root.",default="k:/") <3> hi does anyone here know a python chat server / chat client (very simple one), that is _not_ based on any standards like irc, jabber, msn, ect. <0> kristalino: maybe something in twisted <3> cosmint, ok, i check that. But anything that is in twisted frightens me a little, i don't know why ;) <0> It should. <0> I would write my own. <1> so any ideas why my extension crashes? http://rafb.net/paste/results/abKYfq60.html <4> cout, wouldn't the ref count be one even if the data was just freed ? and the mem manager didn't write something over it yet <1> eblis: I thought the object was freed when the ref count dropped to zero <0> No <0> It is marked for freeing <4> i don't know if python decreases the count to 0 and then check or checks to see if it's 1 and then just frees it knowing it would have been 0 after a -- <0> You don't know when it frees <1> that's what I meant <4> *check or checks = checks :) <1> but it won't free if the refcount is 1 unless it detects a cycle, which I think is impossible with a refcount of 1 <1> this is my first extension, so if I'm getting the details wrong, please let me know <0> It probably crashes because you are using gtk. <1> hehe <0> Seriously. <0> Toolkits always do weird stuff. <0> main threads, other threads, main loops... <5> In metacl***es, should the arguments for __new__ be (cls, name, bases, dct) or (cls, name, bases, attrs)? I've seen both used. <0> Putting that into a python extension probably takes care. <0> veracon_: I think dct is attrs. <0> veracon_: "dict" is in the examples, but it's just a variable NAME. <5> cosmint, that's what Django does, but a guide to metacl***es I'm reading says dct <5> (I'm looking at Django for some examples) <4> is Py_BuildValue("()") faster than PyDict_New() ? <0> veracon_: Doesn't matter, it's just a name. And "dict" is the name in the Python docs. <1> cosmint: so I'm not doing anything obviously wrong other than that? <0> cout: I didn't look. <5> cosmint, dict will cause a collision (or what you call it), wouldn't it? dct wouldn't <4> oh, i just saw it's a touple, not a dict <0> veracon_: No <0> >>> def foo(dict): <0> ... print dict <0> ... <0> >>> foo('s') <0> s <5> cosmint, won't it collide with the dict type? <5> I see <0> It's just in the examples. <0> I wouldn't recommend it. <0> That's why someone picked dct. <0> And someone else picked attrs. <5> I see <0> Since attrs might be a better variable name. <5> The style guide didn't say anything on this <0> As I said, it's just a variable name. <5> So I ***ume it's not something like self or cls -- that's pretty strict? <6> it will only hide it inside that function <0> veracon_: If we are talking about it, then it's probably not recommended. <5> I see, I will use attrs, thanks :) <0> I hope django doesn't make people close-minded to my much better web application development solution. :p <7> It probably will
<0> hehe <7> Popular things do that. Look at XML. <0> Yeah, I think I knew that. <7> I want to dispatch data to different functions depending on the type of the data. Yesterday someone said you could use decorators to do it but I can't think how. <8> " my much better web application development solution" <- reinventing SQL are we cosmint? <0> kousu: Ehh, yeah.. <0> I want cl*** decorators already. Anyone know if they are in 2.5? <0> cout: I'd take out the gtk stuff. <0> cout: And learn to make your first extension run before adding it back. <1> cosmint: that's sort of integral to what I need to do <0> You need to do something else first though. <0> Make this a skeleton module. <0> I bet you will find gtk is crashing it. <1> I've written C extensions for both perl and ruby. <0> "was" crashing it. <0> Then learn to add gtk back in, and initialize and bridge it correctly. <1> I can <0> 't <1> I know that taking gtk out will stop if from crashing, because it happens to be crashing in a callback from gdk <0> Those last 6 lines are, for me, extremely suspicious. <0> cout: Ok, thanks for telling us. <9> is there a "python way" to document C code for an extension module? <4> hmm, don't you have to define a sentinel while enumerating the functions <0> Though, you don't really know a crashed is really caused by the place it crashes.. <0> Anyway, if you think you know it's gtk, then you simply have to learn to initialize and bridge it into Python correctly. <0> You may find the relevant information in topics detailing putting gtk in shared libraries. <0> Or gtk components in shared libraries. <4> the static PyMethodDef Methods[] ... don't you have to have an entry with NULL, NULL, 0, NULL ? <0> ie. Not specifically related to Python extensions, but probably directly related to your problem. <1> I don't understand what you mean. gtk is already in a shared library. <0> Calling gtk from shared libraries. <0> Using gtk from shared libraries. <1> hmm. <9> Eblis: an entry with just {NULL} works <0> Maybe you first need to understand why this is even a concern. <0> It has all to do with threads, main and loops. <4> bmonty: if in c++, right ? anyway, there's no such entry either <0> And, inside a dll/so, all perspective on those things changes. <1> I only have one thread at the moment. <0> Couple this with a toolkit, which is very particular about such things, and you have the current dilemma. <9> Eblis: I'm using it with C, and my understanding is that it is required but unfortunately I haven't figured out why yet <2> is there a more convenient way to get an absolute correct etc path to a folder than os.path.abspath(os.path.expanduser(os.path.expand(......)))? <7> Can't os.normalize() replace abspath and expanduser and expand? <2> dunno, ill have a look <1> cosmint: if your goal is to frustrate me through subtle insults, you are succeeding. <2> kousu: seems like i dont have that function <7> Hmm <7> It must be called something else <7> I'll look <2> you mean normpath? <7> That might be it <2> seems like that doesnt expand ~... <2> i wonder if i need that expanding stuff anyways... <9> timonator: you could create a wrapper to simplify things for yourself <2> hmm... that might be overkill right now :) <2> os.path.expanduser(os.path.normpath("~/.ut2004/Cache/..")) <-- this seems to be just fine <7> How would you detect a recursive structure like a={}; b={}; c={}; a['b']=b; b['c']=c; c['a']=a ? <10> anyone know the correct/safe/secure way to add a user to the system (linux) from a python script? <7> I know with OpenBSD there's a OpenBSD.py module that gives access to system services like that <7> http://docs.python.org/lib/allos.html doesn't list anything like what you want. It might not be in the standard lib <11> kousu, traverse your data structure and remember objects you see. <10> what about disabling an account (not deleting, but preventing the user from connecting with ssh,rsync,ftp,etc until renabled)? <7> You'd edit /etc/users or something <7> I think if you're just looking for a quick script you can get away with tweaking the files "by hand" <12> or set the p***word to an invalid hash of the appropriate type <7> soyt: and then something like "if obj in remembered_objs"? But that only compares with ==, not 'is'. <7> soyt: would the only way be to loop through the entire list each time and use 'is' myself? <2> cachedir = os.path.join(os.path.expanduser(os.path.normpath(options['directory'])),"Cache") <2> AttributeError: Values instance has no attribute '__getitem__' <2> what the hell? :( <11> kousu, remember objects ids in a set
Return to
#python or Go to some related
logs:
#linux #math etherape quit unexpectedly livinded ntpd.conf fedora core 4 both webcam and tv-card linux udev #math #bash #linux ubuntu timestamp too far in future
|
|