@# 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



Comments:

<0> Aside from design/modeling issues
<1> not really
<1> if your threads are mostly doing IO, then threading can help a lot
<2> I forgot about that damn GIL
<1> if you have a CPU bound processes either move them into an extension (which can release the GIL and allow other threads to run) or use multiple processes (probably the best option)
<0> Where I work, we've found multiple processes with shared mem to be a solid option
<2> I must be more interested then hawking .. you readin this stuff hawking?
<1> what do you use to do the IPC, enodran?
<2> enodran, ya, I was thinking of some IPC to circumvent that problem
<0> All custom work, things done before I began
<3> exeonic : yeah readin ... had to go to bathroom
<0> exonic: But what exactly do you mean what do we use?
<1> enodran, I was wondering what you use to communicate over the shared memory: pickles, the struct module, other?
<0> Looks like a custom C wrapper
<4> how do you parse a date like feb 15 15:25:58 to a datetime?



<5> hello snowblink
<5> I think the mxDateTime will parse that Sonderblade
<6> You can p*** it in a datetime.datetime, but that might be overkill
<5> I have a script that executes the following cmd line "C:\Tools\PostgreSQL\8.1\bin\pg_dump.exe -d test -F c -U postgres -f c:\BACKUP\test.dump.20060215"
<5> rpoblem is
<5> if I execute this from another python script the cmd line fails
<7> problem is.. it doesn't work? :P
<7> :-\
<6> Probably because \ escapes the succeeding char
<6> Try replacing \ with \\
<5> nah - I can execute the script like $python backup.py
<5> and it works
<5> or I can execute the exe I createed with py2exe $backup.exe and it works
<5> but when I use another script to run it it fails
<5> on just that line
<5> alll the other batches are fine
<5> no idea wots going on
<7> how are you executing this command?
<8> then maybe there's some problems with paths and current directories
<7> and how are you executing the python script?
<5> I have another script (exe) that calls the py2exe built script
<7> stain has a point :P
<5> it really isnt the excape chars that is tthe problem
<7> hmm..
<7> i'm not familiar with py2exe
<5> as I can run the script by hand no probs
<4> m0no: is there nothing in stdlib for that?
<8> so how do you "execute it from another script" ?
<5> I use win32process.CreateProcess
<5> or os.popen
<7> o_O
<5> either way works fine from the interpretter
<5> but fails on just that line when I call it from another script with popen
<5> so liturally I can type into the interpreter exeacty what is in my script and it runs, but otherwise fails
<5> AARRGGG
<8> m0no: sowhat do you mean by "fails" ?
<8> maybe you should read the error message
<5> stain - the dump file created has a size of 0
<5> stain there is no error
<5> this is y its driving me crazy
<8> but it is created? it is not a problem of being the right postgresql user or something? or some postgresql environment settings?
<5> stain the file is created successfully, and as I say - if I run the script by itself it works perfectly
<5> there are other shell commands it runs as well that work in both scenarios
<5> only the pg_dump cmd fails when the python script is called from another python script
<8> try reducing the script to a minimum.. for instance ONLY doing og_dump
<8> pg
<9> hi
<5> stain kk will try now
<8> and what is this "other python script" doing?
<9> how can i see the traceback of another thread using e.g. pdb?
<5> stain both scripts are packaged into exe (using py2exe) but that is not the problem
<5> stain the second script simply calls the first and ignores the return - it basically just lanches the first
<5> stain what is frustrating is that this in the same dump script I also have it creating an SVN dumpfile, which is fine
<9> or at all? there is a twisted server running and i need to see where it is currently in all threads
<5> stain - script is now the minimum it can be, same problem
<8> ok, now do the same with the caller
<8> and then try make the caller into a bat file instead, and run it from the same place
<8> and also.. I hope you are running these the same way
<8> not running one as SYSTEM and one as Administrator or something
<5> stain - yes, I am running them both the same way
<9> is it possible to access stack frames of another thread?



<9> .oO(without writing your custom trace func)
<10> How do i flush STDOUT or STDERR?
<11> subopt: dir(sys.stdout)
<10> CardinalFang: thanks
<2> CardinalFang, heh
<12> about how many lines would a prime number finding script be?
<11> A dense one, maybe three.
<12> ... 3?!
<12> mine is 23.. :(
<11> map, filter and list comprehensions, and lambda are powerful. One can pack a lot of whallop in a small area.
<11> I think I would prefer a 23-line one anyway.
<12> i've never understood lambdas...
<11> I can explain it:
<12> nice explanation!
<0> What's there to understand
<12> a lambda
<11> If you "def foo(x): ...." , what is foo ? Not foo(), but just plain foo ?
<12> nothing?
<12> undefined variable?
<11> It's a reference to some kind of object.
<0> lambda is the object without the reference
<11> Try it. Open an interactive interpreter.
<13> what are unscriptable errors?
<0> When something is unscriptable
<0> What line gave you the exception
<11> enodran: That's not helping.
<13> enodran, oh thanks
<0> cold_boot: When you're trying to access something "as a list/tuple/collection" that isnt
<14> e.g ((lambda (x) (+ x x)) (* 2 3)) => 12
<0> Or rather, doesnt handle the methodology
<11> cold_boot: Usually, you're trying to index something that doesn't have indexes. Perhaps you're trying to access None as if it's a list, or something like that.
<15> <14>: looks like LISP :-/
<13> i'm returning a time string from a mysql db and i want to remove the seconds from it by shift().time()[:8]
<14> that is
<14> sorry
<5> stain - with the caller stripped to win32process.CreateProcess(blahblahblah) it works!
<11> Naerey: Well, what did you find out?
<8> m0no: aha! Then try to increase again until the bug reappears =)
<5> stain: ty 4 your help :D
<8> m0no: no problem.. common bug-searching technique =)
<12> do i tell python that X is lambda?
<11> Do what I said. Open an interactive interpreter, and.....
<12> one second... ill fix internet first..
<8> thank you
<16> hrm.
<16> is there any way of manipulating headers in xmlrpclib-calls?
<16> i have an additional header to add that contains the checksum of the sent data...
<11> hds: Extend the xmlrpc cl***(es) and make it do what you want.
<16> CardinalFang: hm ok. no way of doing it with any parameters?
<11> hds: I have no idea.
<16> CardinalFang: ok
<11> Use the Source.
<16> CardinalFang: hehe
<17> From a good practices stand point... Is self.somefunction(self.anotherfunction()) better than x = anotherfunction() self.somefunction(x)?
<18> hello all, i'm fairly new to python and trying to do something that should be pretty simple. I've got a list formed like this: biglist = ['1 apple','14 dog','3 chicken'] and I need to be able to sort it so that it returns 1 apple, 3 chicken, 14 dog.
<11> monkeywk: So, you want to split the string into two parts, and treat the first part as a number, right?
<18> as long as they remain relational later on
<18> meaning that I can easily tell that 1 is apple and not dog
<11> monkeywk: What version of Python are you using?
<18> 2.4
<11> Good.
<11> Will you ever have two same numbers with different animals?
<18> yes - using the animals is a bad example, basically what i'm doing is a dns lookup getting all the MX records of a host (so the results come back 1 somehost.com 5 somehost.com etc) so there is a chance I'll have multiple MX records with the same priority
<11> Gotcha. One sec.
<8> num,rest = line.split(" ", 1) by the first space, make a new list with tuples (int(num), rest) and then sort this list
<11> biglist.sort(key=lambda s: int(s.split(" ", 1)[0]))
<11> That will give you the records in numerical order, but not sorted alphabetically by animal/hostname.
<18> >>> biglist.sort(key=lambda s: int(s.split(" ", 1)[0]))


Name:

Comments:

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






Return to #python
or
Go to some related logs:

iptables xebian
#linux
t
#math
www.ambiguism.com/sandbox/scripts
lvm dd bzip
apt-get install zlib-dev
#perl
ubuntu 1680x1050 how
rearrange swap partition ubuntu



Home  |  disclaimer  |  contact  |  submit quotes