@# 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> Aeos: a string is an object.
<1> pickle uses the copy_reg module underneath IIRC
<0> Aeos: so now you just have to figure out which object it doesn't work with ;)
<2> Erwin, well... I was talking about that
<2> Aeos, and we all know what Murphy tells us
<3> it doesnt work for an image
<1> What's an "image" ? If it's a pure-python object it might work. If it's written in C, it needs support from the C code to pickle it.
<1> Python can't look inside your C structures
<3> hmm true
<3> I will try closing all images first
<1> Closing them where?
<1> If you have a object holding referesnce to the images, you can use __getstate__ to return a dictionary sans the images
<3> Sorry, My program is a game. The tile images can be deleted and reloaded on startup
<3> so deleting them prior to pickling is not an issue
<3> it keeps complaining about polygon
<3> builtin method polygon of draw.graphics



<4> hello everyone
<4> i need to convert a png image to xpm, anyone knows how ??
<4> cant do it with pil and getting despered :(
<5> pngtopnm ?
<6> convert
<6> (imagemagick)
<4> yep taht one i know and works, the real question is that i qhant to do it from python, is it possible ??
<4> anyone ??
<7> TuXado PIL is your best bet
<7> TuXado failing that, os.system('convert') ? :)
<4> ok, lets try another aproach :)
<1> Surely PIL knows XPM
<6> or write an XPM writer yourself
<6> Erwin, read-only
<1> How odd. Well, XPMs are very simple
<6> in principle yes
<4> my real problem is that im using pyqt and need the "xpm data" to construct a QPixmap object is there a better way ??
<4> any pyqt users around ?
<1> pyqt should be able to do it using a QImage
<1> ask in #qt, TuXado
<1> But QPixMap::convertFromImage ?
<4> Erwin, i know, but cant find the way to make him load an image without complaining about the type p***ed :(
<1> So, convertFromImage.
<4> when i do it, i load the Qimage with an image file but convertFromImage always complains
<8> is there a way to suppress the blank between 'a' and 'b' when I
<8> >> print 'a', ; print 'b'
<9> roadfish: + ^^
<9> Last time I ask not with print
<9> roadfish: but use
<9> sys.stdin.write(str(a))
<1> TuXado: Ask in #qt.
<7> print '%s%s' % (a,b)
<9> parks: this is not he proble
<10> I have a somewhat involved question regarding the best way to handle a crap-ton of vertex data I'm getting from Blender. I have a cl***, Vertex, and a set of all the unique vertices in a mesh. What's the best way to find an element's "index" into the set after I've created it? Do I need to keep a seperate indexing object around?
<4> thanks Erwin ill do it
<11> what's that shorthand thing to transform a list? (run a function over a list)
<10> pengo: comprehension?
<12> map? list comprehension?
<11> yes
<13> pengo: [foo(bar) for bar in baz]
<10> pengo: [foo(x) for x in list]
<11> thanks :)
<10> hehe
<9> deltab: yop
<11> too much java for me
<9> pengo: in python this is simple
<12> cubicool: sets don't have indices
<9> pengo: you can filter too
<11> marienz, nods, just forgot the syntax and name :)
<11> cheers
<9> [f(i) for i in l if i=="sapin"]
<10> marmoute: omg, the horror
<9> cubicool: oo:-)
<12> cubicool: all they store about their members is whether they're members
<9> cubicool: you are right
<9> [f(i) for i in l if i<5]
<9> cubicool: happy
<9> ?
<5> cubicool: are you sure it's a set and not a list?
<12> cubicool: actually I think I'm oversimplifying that, so ignore it



<10> Well, I was reaching for the set since it guarantees only unique entries.
<5> cubicool: why not put it into a dict?
<14> is there a way through another function to see the length of arguments in a function?
<8> marmoute: thanks for the answer
<10> See, Blender feeds vertex data arbitrarly, so I need a build a sequence of some sort and then later create a list of indices into that sequence.
<5> cubicool: then you get easy access by whatever
<5> cubicool: so you need to track order?
<12> ObsidianX: try the inspect module
<10> pjz: Yeah.
<5> cubicool: I'd be tempted to keep 1) a list of keys and 2) a dict of data
<10> pjz: that's my current method... but it's really slow.
<12> or a dict of indices
<10> pjz: I guess there's no getting around the speed thing though.
<5> cubicool: well, what are you doing with it?
<14> deltab: thanks
<5> cubicool: I mean, do you run through the sequence more than you do direct lookups?
<5> cubicool: b/c you could also keep a list of tuples (key, value)
<10> pjz: Hmm, that's not a bad iead
<14> sweet, thats perfect
<12> what's this for? compressing a set of vertices into an indexed list containing only unique vertices?
<10> deltab: yes.
<7> ObsidianX def func(*args): len(args) ?
<12> you could use a dict with the vertices as keys
<10> deltab: you have a vertex buffer consisting of (optimally) unique entries and then a separate index buffer into the previous buffer.
<12> and the values as the indices
<14> parks: i wanted to see how many argments there were in a given function from outside that function
<7> ObsidianX probably need to use a decorator then
<14> inspect worked perfectly
<14> len(inspect.getargspec(function)[0])
<12> if v in d: vi = d[v]; else: vi = d[v] = len(va); va.append(v)
<15> OK, stupid question, but I'd like to run some external programs...
<15> How in hell do I do that with python??
<12> Captain_Fleming: subprocess module
<7> deltab dict.get(v), []).append(va) ?
<15> OK, stupid example: I'd like to run 'ls -l' in python...
<7> Captain_Fleming os module
<15> deltab: Quite cryptic...
<12> parks: no, that throws away the new list
<15> parks: Bit more explain please :-S
<15> *explaining
<12> parks: also it always creates a new list whether needed or not
<7> Captain_Fleming pydoc os
<12> Captain_Fleming: I recommend subprocess instead; it has a uniform interface and allows you to give arguments as a list easily
<7> deltab .get() will only return an empty list if that key hasnt been seen before
<12> parks: but it always creates that list
<7> ok
<16> the list literal is created before get is called
<17> what's the easiest way to make a time stamp
<7> use list() then
<15> deltab: Thanks, I can work on that for a while.
<18> I found out that I have to free the GIL in my swig wrapped C module called from a wxpython GUI. Is that how it works? How can I use the PyGILState_STATE function, I mean include such python stuff in my C?
<12> http://python.org/doc/lib/module-subprocess.html
<12> rodrickbrown: what sort of timestamp do you need?
<17> yyyymmddmmss
<12> parks: it'll always get called
<12> parks: arguments to a function always get evaluated
<10> yeah, wouldn't list() get evaluated first?
<10> before the function invocation
<12> yes
<7> .get(v, None) or list()
<7> either way
<7> deltab is probably correct
<19> can i use the http module to fetch files?
<20> heh
<20> "Gnu feature.. 4 letters, MA_E"
<19> Say i have a bunch of mp3s in a directory, can i fetch themw ith a python script that iterates thru and saves each one to a given directory on a windows machine
<16> parks, now the new list doesn't get saved into the dict
<13> MFen: MALE?
<20> i was going to say "make", but it's mane
<20> it should be make
<21> korhalf: You could, but it'd be easier to use something like wget
<19> on a windows machine?
<21> Yes
<11> wget can be got for windows


Name:

Comments:

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






Return to #python
or
Go to some related logs:

AddHandler python-program .chm
#sdl
FC4 OpenGL/Mesa
#web
python *pointeur fonction
mushrooomprince
sony VGN-S270 Driver
#web
#mysql
#gaim



Home  |  disclaimer  |  contact  |  submit quotes