| |
| |
| |
|
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> .start <1> hi. Anybody familiar with pyparsing around? <1> it seems it won't p*** me exceptions on certain parse failures <2> I'm still trying to figure out which python xml-parser is the easiest to use.. <2> any tips <3> bushwakko: depends on what you want to use it for. xmltramp is one of the easiest, if you want to read in the whole XML document and access it as a Python object tree. <2> that sounds simple eys <2> anyone tried anobind? <4> Yhg1s: do you ever sleep? <3> ironfroggy: six to eight hours each day. <2> nice endorsmenet of xmltramp <2> Endorsements <2> "xmltramp looked enticing to me when i first saw it, but it's actually a quick-and-dirty hack that corrupts data" -- Mark Pilgrim <2> hehe <5> anybody know of a good how-to or tutorial for using python to do shell scripts? (Can't seem to find one with google.) <4> well python isnt a shell
<6> hi all <5> ironfroggy: Are you advocating NOT to use python for shell scripts? <7> nah <8> swissmade: "using python for shell scripts" is too general. <5> Cocytus: FreeBSD6 <5> My python is poor and I want to improve it. I have to write a lot shell scripts over the next 2 weeks and .. <5> instead of sticking to bash, I thought this is a good time. None of these scripts are performance critical, but some deal with complex data structures. <7> sounds like a nice python practice to me :-) <5> pfote: My thinking exactly. :) <3> swissmade: 'shell scripts' generally means 'scripts that just start loads of other tools', and that's not Python's strong point. <3> swissmade: and there's certainly not a specific tutorial for that. <5> The scripts bascially should automate setup of zope instances, postgresql databases (and initial population) and such. <5> Yhg1s: Ok. I'll stop searching for them. :) <2> hmmm that data binding thing for 4suite (amara) wouldn't even install :/ <7> swissmade: you will have to use system() from time to time .. but the tasks you mentioned can be handled with python as good as in any other script language <7> .o0(in the other chan a guy wants to write a daemon in emacs lisp .. compared to that, writing shell scripts in python seems very ordinary to me ;-)) <5> pfote: Indeed. I don't like bash much. (it's just what I started to use initially.) <2> not to talk down on amara, I used devel version and not stable <9> is there something like a raw codec that converts a unicode string to a byte string? <3> cr***: not 'raw', no. how would it be 'raw'? Unicode itself odesn't define such an encoding. People usually mean 'UTF-16' or 'UTF-32' when they say 'raw'. <3> (or UCS-2 or UCS-4, which is more or less the same thing.) <3> What encoding Python uses internally is not something you should care about (and besides, it depends on how Python was compiled. it currently uses either UCS-2 or UCS-4, but you can't tell from looking at unicode objects.) <9> hmm, I'vev got a filename string that has been encoded to unicode, and I want to get that string back without knowing what was used to encode it. Is this possible? <10> cr***, what do you think? <3> cr***: I don't know what 'encoded in unicode' means. You either have unicode, which isn't encoded, or you have an encoded string (ASCII, ISO-8859-1, UTF-8, UTF-16, etc). <11> What is sense of using utf-16 in internal repr of strings ? One loose constant char enc length and have at least 2 bytes per char ... utf-8 would be better <3> cr***: which one do you have? <9> sorry, decoded to unicode <3> Tachyon76: in UTF-8, indexing and slicing and such are very expensive operations. <11> so are in utf-16 by same reasons <3> cr***: you can't know what encoding the original bytestring from just looking at the unicode object. it just doesn't have that information. <3> Tachyon76: yep, hence the use of UCS-2 or UCS-4. <3> Tachyon76: they are fixed-width. <11> ah OK :) <3> Tachyon76: and while UTF-8 is less wasteful for ASCII characters, it's actually a lot more wasteful for non-latin characters ;P <9> is the default display of unicode strings in utf-8 then? <12> yeah, but it's safe for operations that don't understand it <12> as in, if I tried to split over whitespace, a utf-8 character will never use 0x20 unless it's actually a space <12> or whatever a space is <13> hi, what's the socket status (connected or not) in a asynchat.async_chat subcl***? <14> Hi, how can I reference the function of a module imported at the top of the cl*** file within cl*** definition? While trying to do so its looking the function within cl***'s scope and throwing exception. <13> ok, i've finally found <11> cr***: I think you are messing with terms a little. Pls read http://en.wikipedia.org/wiki/Unicode <3> cr***: no, the default display of unicode strings tries to encode it into ASCII. <3> xcess: what is a 'cl*** file'? <3> xcess: I'm not entirely sure what you are asking after. are you trying, in a cl*** definition, to refer to a module you imported at the global scope? That should just work. <14> Yhg1s: I guess yes. I am using the import statement at the top of the cl*** file. While referencing of of the functions of that imported module I am getting the error. <9> Yhg1s: are you sure not latin? because I have a unicode string that prints without errors, but raises an exception when I try to encode it to 'ascii' <14> Yhg1s: AttributeError: 'xxx' object has no attribute 'abc' <3> cr***: it depends on the environment. the *default* is to encode to ascii, but if your environment says otherwise, that is used instead. <9> but regardless, I meant when you do a repr() of a unicode object <1> anybody with any knowledge of pyparsing interested in taking a look at http://deadbeefbabe.org/paste/727 ? <3> xcess: and 'abc' is the module, or the function? <3> cr***: repr() uses escapes for any non-printable characters. <3> >>> print repr(u"\N{EURO SIGN}") <3> u'\u20ac' <14> Yhg1s: 'abc' is module.' <9> right, and that escape is in utf8, right? <3> cr***: no, it's unicode.
<3> cr***: it's not encoded. the \u escape sequence (and the \U one) refer to unicode codepoints. <15> anyone use soappy? <3> xcess: should just work, and it works fine when I test it here. <3> xcess: so something else is wrong. can you pastebin the code? <14> Yhg1s: I am using obj = abc.myfunction("someparameter") <3> xcess: that doesn't generate the error you pasted before. <3> xcess: that would raise a NameError, 'abc not defined', rather than an AttributeError. <9> thanks Yhg1s, I think I understand now <3> xcess: try 'self.abc.myfunction(...)'. But better yet, don't do it that way, just import the module at the global level and use that. <14> Yhg1s: I am doing in this way <14> Yhg1s: import abc <14> Yhg1s: cl*** MyCl***(object): <3> xcess: so, the import isn't inside the cl*** statement? <14> Yhg1s: no, I wrote above. The import statement is at the top of cl*** file. <3> xcess: I don't know what you mean by 'cl*** file'. Python doesn't have 'cl*** files', just 'modules'. <3> xcess: please paste a non-working example to http://deadbeefbabe.org/paste <3> including the exception it raises. <11> Hmm if python is build with --enable-unicode=ucs4 what is size of char of regular string ( 4 or 1 byte) ? <3> Tachyon76: the unicode size has no effect on regular strings. <16> What's the syntax of a list compression to build a dict ? Can you do something like {(k, v) for ...} <14> Yhg1s: Please have a look at the code and error at http://deadbeefbabe.org/paste/728 <11> prolific, dict ( [ (k,v) fro ... ] ) ? <16> ahh <16> can't use the { } directly outside a list comprehension ? <3> xcess: the 'fmt = self.logging.Formatter()' call should just read 'fmt = logging.Formatter(...)' -- 'logging' isn't an attribute of self, it's just a global name. The first call, to logging.getLogger(), is correct. <3> prologic: nope. <16> k ta <17> can someone tell me how to run a shell script from a python program? I've messed with spawnvp() and I'm having a difficult time with it <3> darklich14: the subprocess module, the commands module, os.system, the popen2 module, os.popen, os.popen2 <14> Yhg1s: Thanks a lot buddy. Its working now. ;) <3> depending on what you really want. <17> Yhg1s: hmm.. I'll give the commands module a shot. looks like what I want <18> hi, I have this script using threads that can't be interrupted with ctrl+c <18> http://deadbeefbabe.org/paste/729 <18> I've been searching solution for couple of days with no decent results <18> can you point me to right direction <3> brutopia: that's correct. it can't be interrupted with ^C. <19> hi, I'd need some descriptor help. I've written a descriptor and ***ign it for a cl***, so when it gets invoked I save the value in the self of the descriptor. however, that makes that all instances of this cl*** share the same variable for that. <3> brutopia: it's an attribute of how threads work. <19> do I need to ***ign the descriptor in the __init__ of the cl***? <3> __doc__: what's the code look like? <19> Yhg1s: run of the mill descriptor example <18> I tried also creating Event object which tells childthread when I want to exit put my signalhandler for sigint was never called <19> Yhg1s: I ***ign the descriptor as a cl*** attribute, not as an instance attribute <18> I'm using windows btw <19> Yhg1s: so sort of it's logical that all cl*** instances use the same desriptor right? <3> __doc__: sure. but they also get the instance they were invoked on, as argument. <3> __doc__: hence my request to see the actual code :) <3> brutopia: I'm not sure what you're looking for. that example can't be interrupted with ^C. so, don't do it that way. <3> brutopia: the reason the signal handler doesn't get called is probably that the main thread is busy exiting, it's just waiting for the other thread to finish. <19> Yhg1s: yes I noticed that. But in the presence of multiple such descriptors for a cl***, what use is that obj instance to me? <18> I have one thread as a tcp server and main thread waiting for it to finish <3> __doc__: eh? I'm afraid I don't understand the problem. I thought your complaint was that all instances shared the value? <19> Yhg1s: correct, because I write the value into the self of the descriptor <18> I'd like to be able to use ctrl+c to terminate program <19> Yhg1s: so how do I get a Descriptor per instance? <19> Yhg1s: if you want that's the example http://rafb.net/paste/results/zC4xtr84.html <19> Yhg1s: I tried putting the Descriptor instanciation in the __init__ of Progress but then the descriptor methods are not called <19> Yhg1s: of course I could do something like msg = ThreadSaveVar('msg') but that's sort of stupid isn't it? <19> Yhg1s: still there? <20> Hi folks... I'm using shutil.rmtree() to try to do a simple rm -rf <20> I'm running into issues with read-only files, though <20> I see there's a third parameter "onerror" to the function, though... but I'm not really sure what to give it <21> hello <20> the docs say it's a "handler" -- can I just use another function? <19> need help with that descriptor http://rafb.net/paste/results/zC4xtr84.html, it's using the same state for all progress instances...? <22> epoch: yes, that's right <23> eponym <21> I would like to start learning python <21> I want to build a very simple sequencer <21> what resources would you guys recommend? <19> how do I make a descriptor for each *instance* of a cl*** (instead of one for each cl***) <10> http://docs.python.org/tut/tut.html <20> ChrisLong: hrm... ok so, I see the handler's given 3 parameters, are these documented somewhere?
Return to
#python or Go to some related
logs:
#linux manhatten distance
guru.repo for suse debian vmware no screens found PyInstaller ebuild gentoo clock skew detected recursive touch entered block size does not /usr/sbin/mkinitrd: Cannot determine root device richzo mathxl crack
|
|