[issue22453] PyObject_REPR macro causes refcount leak

2014-09-21 Thread Chris Colbert
New submission from Chris Colbert: This is how the macro is defined in object.h: 2.7 /* Helper for passing objects to printf and the like */ #define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) 3.4 /* Helper for passing objects to printf and the like */ #define PyObject_REPR(obj

[issue16272] C-API documentation clarification for tp_dictoffset

2012-10-17 Thread Chris Colbert
New submission from Chris Colbert: The documentation of the tp_dictoffset is a bit unclear when describing the responsibilities of a base type with a nonzero tp_dictoffset. http://docs.python.org/c-api/typeobj.html I feel there should some statement to the effect of: If a type defines

Re: Terrible FPU performance

2011-04-26 Thread Chris Colbert
On Tue, Apr 26, 2011 at 8:40 AM, Mihai Badoiu mbad...@gmail.com wrote: Hi, I have terrible performance for multiplication when one number gets very close to zero. I'm using cython by writing the following code: You should ask this question on the Cython users mailing list. --

Re: a basic bytecode to machine code compiler

2011-04-02 Thread Chris Colbert
That's quite an interesting idea. I do think a lot of production Python code implicitly depends on the GIL and would need rework for multicore. For example, code that expects n += 1 to be atomic, because the CPython bytecode interpreter won't switch threads in the middle of it. -- Yes it

[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Chris Colbert
New submission from Chris Colbert sccolb...@gmail.com: The cmp_to_key func acts as a class factory for generating key objects that behave according to a user defined cmp function. Many patterns/libs that make use of key functions (for example blist and the SortedCollection recipe) store

[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Chris Colbert
Chris Colbert sccolb...@gmail.com added the comment: Man, you guys are quick! Cheers! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11628

Re: [newbie/2.5.1.1] Computing value of a word?

2011-02-16 Thread Chris Colbert
On Wed, Feb 16, 2011 at 4:27 AM, Chris Rebert c...@rebertia.com wrote: On Wed, Feb 16, 2011 at 1:17 AM, Gilles Ganault nos...@nospam.com wrote: Hello, For a game, I need to go through a wordlist, and for each word, compute its value, ie. a=1, b=2, etc. So for instance, NewYork = 14 +

Re: palindrome iteration

2010-09-12 Thread Chris Colbert
;) In [29]: s = 'bannab' In [30]: a = np.frombuffer(s.lower(), dtype='uint8') In [31]: np.all(a == a[::-1]) Out[31]: True In [32]: s = 'bannac' In [33]: a = np.frombuffer(s.lower(), dtype='uint8') In [34]: np.all(a == a[::-1]) Out[34]: False --

ANN: Pymazon 0.9 released!

2010-06-27 Thread Chris Colbert
I am happy to announce the 0.9 release of Pymazon. http://code.google.com/p/pymazon/ Pymazon is a Python implemented downloader for the Amazon MP3 store. This release is a near-full rewrite which brings a brand new GUI design and a host of new features: Notably: - Pymazon now supports MP3

Re: how to get text from a html file?

2010-04-13 Thread Chris Colbert
On Tue, Apr 13, 2010 at 1:58 PM, varnikat t varnika...@gmail.com wrote: Hi, Can anyone tell me how to get text from a html file?I am trying to display the text of an html file in textview(of glade).If i directly display the file,it shows with html tags and attributes, etc. in textview.I don't

Re: get objects from image

2010-04-08 Thread Chris Colbert
lookup connected component labeling in a machine vision book. On Thu, Apr 8, 2010 at 9:57 AM, Chris Hulan chris.hu...@gmail.com wrote: On Apr 8, 9:17 am, Jannis Syntychakis ioan...@live.nl wrote: Hallo Everybody, Maybe you can help me with this: i have a picture. The picture is black, with

Re: How to open and read an unknown extension file

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 11:42 AM, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: On Thu, Apr 8, 2010 at 9:00 PM, varnikat t varnika...@gmail.com wrote: I am trying to do this if os.path.exists(*.*.txt):             file=open(*.*.txt)            

Re: Generating a rainbow?

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 12:46 PM, Tobiah t...@rcsreg.com wrote: I'm having a difficult time with this.  I want to display a continuous range of hues using HTML hex representation (#RRGGBB).  How would I go about scanning through the hues in order to make a rainbow? Thanks, Toby --

Re: Generating a rainbow?

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 1:14 PM, Tobiah t...@rcsreg.com wrote: Look at the colorsys module. http://docs.python.org/library/colorsys.html?highlight=colorsys#module- colorsys That so rocks.  Thanks! -- http://mail.python.org/mailman/listinfo/python-list How does that answer your original

Re: Generating a rainbow?

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 2:34 PM, Tobiah t...@rcsreg.com wrote: How does that answer your original question? I was able to do this: import colorsys sat = 1 value = 1 length = 1000 for x in range(0, length + 1):        hue = x / float(length)        color = list(colorsys.hsv_to_rgb(hue,

Re: Performance of list vs. set equality operations

2010-04-06 Thread Chris Colbert
the proof is in the pudding: In [1]: a = range(1) In [2]: s = set(a) In [3]: s2 = set(a) In [5]: b = range(1) In [6]: a == b Out[6]: True In [7]: s == s2 Out[7]: True In [8]: %timeit a == b 1000 loops, best of 3: 204 us per loop In [9]: %timeit s == s2 1 loops, best of 3: 124

Re: Performance of list vs. set equality operations

2010-04-06 Thread Chris Colbert
:slaps forehead: good catch. On Tue, Apr 6, 2010 at 5:18 PM, Gustavo Narea m...@gustavonarea.net wrote: On Apr 6, 7:28 pm, Chris Colbert sccolb...@gmail.com wrote: the proof is in the pudding: In [1]: a = range(1) In [2]: s = set(a) In [3]: s2 = set(a) In [5]: b = range(1

Re: python as pen and paper substitute

2010-04-06 Thread Chris Colbert
you may have a look at sage: http://www.sagemath.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: I'm not sure you understand

2010-04-02 Thread Chris Colbert
On Fri, Apr 2, 2010 at 11:35 AM, A Serious Moment marty.musa...@gmail.comwrote: a bunch of droll Do you really not see the complete absurdity of posting an entire paper in this forum as plain text? Not only are you completely off-topic for this group, but the paper as you posted it is

Re: Python + OpenOffice Calc

2010-03-31 Thread Chris Colbert
On Wed, Mar 31, 2010 at 4:21 PM, bobicanprogram ican...@gmail.com wrote: On Mar 31, 2:47 am, Tracubik affdfsdfds...@b.com wrote: Hi all! i'm giving away to a friend of mine that have a garage (he repair car) my old computer. He will use it essentialy to create estimates of the work via

Re: Usability, the Soul of Python

2010-03-30 Thread Chris Colbert
not really, the int will eventually overflow and cycle around ;) On Tue, Mar 30, 2010 at 8:11 AM, Xavier Ho cont...@xavierho.com wrote: Did no one notice that for(i = 99; i 0; ++i) Gives you an infinite loop (sort of) because i starts a 99, and increases every loop? Cheers, Ching-Yun

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 1:08 PM, John Nagle na...@animats.com wrote: Chris Rebert wrote: On Tue, Mar 30, 2010 at 8:40 AM, gentlestone tibor.b...@hotmail.com wrote: Hi, how can I write the popular C/JAVA syntax in Python? Java example: return (a==b) ? 'Yes' : 'No' My first idea is:

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout s...@sig.for.addresswrote: I have two arrays, made with numpy. The first one has values that I want to use as sorting keys; the second one needs to be sorted by those keys. Obviously I could turn them into a dictionary of pairs and sort by the

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 9:59 PM, Chris Colbert sccolb...@gmail.com wrote: On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout s...@sig.for.addresswrote: I have two arrays, made with numpy. The first one has values that I want to use as sorting keys; the second one needs to be sorted by those

Re: GIF89A and PIL

2010-03-27 Thread Chris Colbert
since the images only use a couple colors each, just run length encode it. Depending on the image, you may be able to get a super small size that way, and avoid the whole mess. On Sat, Mar 27, 2010 at 11:32 PM, Harishankar v.harishan...@gmail.comwrote: On Sat, 27 Mar 2010 19:44:54 -0700,

Re: Classes as namespaces?

2010-03-26 Thread Chris Colbert
i use them in Pymazon to encapsulate program wide settings and enforce valid values for these settings. http://code.google.com/p/pymazon/source/browse/pymazon/settings.py On Fri, Mar 26, 2010 at 11:50 AM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: kj wrote: What's the word on

Re: Have you embraced Python 3.x yet?

2010-03-26 Thread Chris Colbert
On Fri, Mar 26, 2010 at 4:07 PM, Mensanator mensana...@aol.com wrote: On Mar 26, 8:23 am, Harishankar v.harishan...@gmail.com wrote: Have you people embraced Python 3.x or still with 2.5 or 2.6? 3.1. The only module I use regularly is gmpy and that's one that has been updated. --

ANN: Pymazon 0.1.1 Released

2010-03-25 Thread Chris Colbert
I'm happy to announce the release of Pymazon 0.1.1! This release brings a big enhancement in the form of PyGtk support in addition to the PyQt4 and Command line interfaces already available. A special thanks to Ray Meyers for his gtk commits! Pymazon Changelog 0.1.1 - - Added support for

Re: nested threading

2010-03-25 Thread Chris Colbert
Spawning a thread from within a thread works just fine. Calling thread.start() is a non-blocking function and returns immediately. On Thu, Mar 25, 2010 at 11:23 AM, Omer Ihsan omrih...@gmail.com wrote: is there anything as nested threadingthat is, call a thread from within a thread. in

Re: C++ code generation

2010-03-18 Thread Chris Colbert
I think Stefan was telling you, in a nice way, to stop spamming every thread about code generation with a plug for your project. 2010/3/17 CHEN Guang dr...@126.com - Original Message - From: Dan Goodmandg.gm...@thesamovar.net I'm doing some C++ code generation using Python, and

Re: execute bash builtins in python

2010-03-17 Thread Chris Colbert
On Wed, Mar 17, 2010 at 11:44 AM, Nobody nob...@nowhere.com wrote: On Fri, 12 Mar 2010 08:15:49 -0500, Steve Holden wrote: For shell=True I believe you should provide the command as a single string, not a list of arguments. Using shell=True with an argument list is valid. On Unix, it's

Re: Possible to open a file for shared write mode under Windows?

2010-03-17 Thread Chris Colbert
you could also just have one process do the writing for both processes via pipes. On Thu, Mar 18, 2010 at 12:20 AM, Gabriel Genellina gagsl-...@yahoo.com.arwrote: En Wed, 17 Mar 2010 23:42:46 -0300, pyt...@bdurham.com escribió: Is there a way to open a file for shared write mode under

Re: Possible to open a file for shared write mode under Windows?

2010-03-17 Thread Chris Colbert
am main process. I am subprocess I am main process. I am subprocess I am main process. I am subprocess I am main process. On Thu, Mar 18, 2010 at 12:52 AM, Steve Holden st...@holdenweb.com wrote: Chris Colbert wrote: [top-posting switched to bottom-posting] On Thu, Mar 18, 2010 at 12:20

Re: loop over list and process into groups

2010-03-04 Thread Chris Colbert
Man, deja-vu, I could have sworn I read this thread months ago... On Thu, Mar 4, 2010 at 2:18 PM, nn prueba...@latinmail.com wrote: lbolla wrote: On Mar 4, 3:57 pm, Sneaky Wombat joe.hr...@gmail.com wrote: [ {'vlan_or_intf': 'VLAN2021'}, {'vlan_or_intf': 'Interface'},

Re: Re: DreamPie - The Python shell you've always dreamed about!

2010-02-23 Thread Chris Colbert
Do you have gtk and PyGTK installed? Sounds like a missing dependency to me. On Tue, Feb 23, 2010 at 6:56 AM, Alan Harris-Reid aharrisr...@googlemail.com wrote: gorauskas wrote: I installed it on a Windows 7 machine with CPython 2.6.4 and I get the following error: Traceback (most recent

Re: Spam from gmail (Was: fascism)

2010-02-23 Thread Chris Colbert
this image is appropriate: http://4.bp.blogspot.com/_pS7sKjlzwFg/SwhG1S901pI/Eiw/XSm93RIY2WE/s400/kelso-burn.jpg On Tue, Feb 23, 2010 at 6:06 PM, Daniel Fetchinson fetchin...@googlemail.com wrote: Is it just me or has the spew from gmail on this list radically increased in the

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Chris Colbert
http://dreampie.sourceforge.net/download.html reading is a wonderful thing. On Sun, Feb 21, 2010 at 11:32 AM, Mensanator mensana...@aol.com wrote: On Feb 21, 10:30�am, Mensanator mensana...@aol.com wrote: On Feb 21, 3:42 am, Noam Yorav-Raphael noamr...@gmail.com wrote: I'm pleased to

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Chris Colbert
This is bloody fantastic! I must say, this fixes everything I hate about Ipython and gives me the feature I wished it had (with a few minor exceptions). I confirm this working on Kubuntu 9.10 using the ppa listed on the sites download page. I also confirm that it works interactively with PyQt4

Re: formatting a number as percentage

2010-02-21 Thread Chris Colbert
print('%.0f%%' % (0.7*100)) 70% On Sun, Feb 21, 2010 at 12:53 PM, vsoler vicente.so...@gmail.com wrote: I'm trying to print .7 as 70% I've tried: print format(.7,'%%') .7.format('%%') but neither works. I don't know what the syntax is... Can you help? Thank you --

Re: Avoid converting functions to methods in a class

2010-02-19 Thread Chris Colbert
this is somewhat hackish: In [1]: def test(): ...: print 'spam' ...: ...: In [20]: class Ham(): : target = {'target': test} : def test_eggs(self): : self.target['target']() : : In [21]: h = Ham() In [22]: h.test_eggs() spam On

Re: How to use AWS/PAA nowadays? PyAWS / pyamazon outdated?

2010-02-18 Thread Chris Colbert
This one works for the product API. http://pypi.python.org/pypi/python-amazon-product-api/0.2.1 On Thu, Feb 18, 2010 at 5:09 AM, Snaky Love snakyl...@googlemail.comwrote: Hi, is anybody aware of any updated and / or maintained library for accessing AWS/PAA with Python? I found the dusty

Re: What happened to pyjamas?

2010-02-18 Thread Chris Colbert
it's working for me. On Thu, Feb 18, 2010 at 1:16 PM, Daniel Fetchinson fetchin...@googlemail.com wrote: Does anyone know what happened to pyjs.org ? Cheers, Daniel -- Psss, psss, put it down! - http://www.cafepress.com/putitdown -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to pyjamas?

2010-02-18 Thread Chris Colbert
On Feb 18, 2010, at 1:44 PM, Chris Colbert wrote: -- http://mail.python.org/mailman/listinfo/python-list

Re: working with laptop battery

2010-02-13 Thread Chris Colbert
You'll need acpi installed: In [6]: import subprocess In [7]: p = subprocess.Popen('acpi', stdout=subprocess.PIPE) In [8]: output, errors = p.communicate() In [9]: print output -- print(output) Battery 0: Full, 100%, rate information unavailable On Sat, Feb 13, 2010 at 8:43 PM, Daniel

Re: fork vs threading.Thread

2010-02-12 Thread Chris Colbert
dont call the .run() method, call the .start() method which is defined the Thread class (and should NOT be overridden). tftpserv.start() xmlserv.start() On Fri, Feb 12, 2010 at 10:57 PM, Jordan Apgar twistedphr...@gmail.comwrote: I'm trying to run two servers in the same program at once.

Re: Read PGM's with more than 256 range in PIL1.1.7

2010-02-08 Thread Chris Colbert
According the pil manual it handles PGM files with '1', 'L', or 'RGB' data which leads me to believe 16bit data is not supported. You CAN write your own decoder for that though: http://www.pythonware.com/library/pil/handbook/decoder.htm It would be trivial to write a decoder for the pgm format.

Re: ANN: obfuscate

2010-02-08 Thread Chris Colbert
I always though a double rot13 followed by a rot26 was the best? On Mon, Feb 8, 2010 at 9:19 PM, Tim Chase python.l...@tim.thechases.comwrote: Steven D'Aprano wrote: obfuscate is a pure-Python module providing classical encryption algorithms suitable for obfuscating and unobfuscating text.

determining which value is the first to appear five times in a list?

2010-02-06 Thread Chris Colbert
I'm working on a naive K-nearest-neighbors selection criteria for an optical character recognition problem. After I build my training set, I test each new image against against the trained feature vectors and record the scores as follows: match_vals = [(match_val_1, identifier_a), (match_val_2,

Re: How to guard against bugs like this one?

2010-02-01 Thread Chris Colbert
This is kinda akin to creating your own libc.so in a folder where your compiling and executing c programs and then wondering why your program bugs out On Mon, Feb 1, 2010 at 9:34 PM, kj no.em...@please.post wrote: I just spent about 1-1/2 hours tracking down a bug. An innocuous little

Re: For loop searching takes too long!

2010-01-28 Thread Chris Colbert
if you're open to other libraries, this could be done extremely fast in numpy. On my machine summing that whole array takes 75ms. On Thu, Jan 28, 2010 at 8:00 PM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Thu, 28 Jan 2010 15:52:14 -0800, elsa wrote: Now, what I need to

Re: list.pop(0) vs. collections.dequeue

2010-01-25 Thread Chris Colbert
On Mon, Jan 25, 2010 at 5:09 PM, Steve Howell showel...@yahoo.com wrote: On Jan 25, 1:32 pm, Arnaud Delobelle arno...@googlemail.com wrote: Steve Howell showel...@yahoo.com writes: [...] My algorithm does exactly N pops and roughly N list accesses, so I would be going from N*N + N

Re: Python, PIL and 16 bit per channel images

2010-01-25 Thread Chris Colbert
On Mon, Jan 25, 2010 at 5:04 PM, Peter Chant pet...@mpeteozilla.vco.ukewrote: Does anyone know whether PIL can handle 16 bit per channel RGB images? PyPNG site (http://packages.python.org/pypng/ca.html) states PIL uses 8 bits per channel internally. Thanks, Pete --

Re: Mastering Python 3 I/O - Special Preview - Feb 5, 2010 (Chicago)

2010-01-22 Thread Chris Colbert
oops :) On Fri, Jan 22, 2010 at 9:41 PM, Steve Holden st...@holdenweb.com wrote: Dave: New York classes went well this week, and there appears to be some demand for Chicago training. How can we satisfy this demand to our common profit? regards Steve David Beazley wrote:

Re: html code generation

2010-01-20 Thread Chris Colbert
use a deque with a 'tdjunk/td' as each element http://docs.python.org/library/collections.html On Wed, Jan 20, 2010 at 4:03 PM, George Trojan george.tro...@noaa.govwrote: I need an advice on table generation. The table is essentially a fifo, containing about 200 rows. The rows are inserted

Re: html code generation

2010-01-20 Thread Chris Colbert
On Wed, Jan 20, 2010 at 4:52 PM, Chris Colbert sccolb...@gmail.com wrote: use a deque with a 'tdjunk/td' as each element http://docs.python.org/library/collections.html On Wed, Jan 20, 2010 at 4:03 PM, George Trojan george.tro...@noaa.govwrote: I need an advice on table generation

Re: html code generation

2010-01-20 Thread Chris Colbert
ah ok, i misread your post. Store each 'trtdjunk/td/tr' as an item in the deque. the idea is the same though. On Wed, Jan 20, 2010 at 4:55 PM, Chris Colbert sccolb...@gmail.com wrote: On Wed, Jan 20, 2010 at 4:52 PM, Chris Colbert sccolb...@gmail.comwrote: use a deque with a 'tdjunk/td

Re: Python IDE for MacOS-X

2010-01-19 Thread Chris Colbert
On Tue, Jan 19, 2010 at 2:09 AM, Jean Guillaume Pyraksos wis...@hotmail.com wrote: What's the best one to use with beginners ? Something with integrated syntax editor, browser of doc... Thanks, JG -- http://mail.python.org/mailman/listinfo/python-list I whole-heartedly recommend

Re: PyQwt installation

2010-01-18 Thread Chris Colbert
On Mon, Jan 18, 2010 at 6:15 PM, Gib Bogle g.bo...@auckland.no.spam.ac.nzwrote: Should there be a problem installing PyQwt5.2.0 with PyQt4.4.4 and Python2.6 on Windows? My student is saying she can't get the Windows installer to work, and she points out that the download site says Binary

Re: lightweight encryption of text file

2010-01-08 Thread Chris Colbert
PyCrypto is already pretty easy to use by itself. I dont know why you want a wrapper on top of it. On Fri, Jan 8, 2010 at 11:02 PM, Irmen de Jong irmen-nosp...@xs4all.nlwrote: On 8-1-2010 22:39, Daniel Fetchinson wrote: http://www.nightsong.com/phr/crypto/p3.py Thanks a lot, currently

ANN: Pymazon 0.1.0 released!

2010-01-07 Thread S. Chris Colbert
Hello, I'm happy to announce the first non-beta release of Pymazon: a python implemented downloader for the Amazon mp3 store. Improvements from the beta: - Running download status indicator - Various fixes for Windows - Some code cleanup Pymazon was created to be a simple and easy

Re: Dictionary used to build a Triple Store

2010-01-07 Thread S. Chris Colbert
Definitely a newbie question, so please bear with me. I'm reading Programming the Semantic Web by Segaran, Evans, and Tayor. It's about the Semantic Web BUT it uses python to build a toy triple store claimed to have good performance in the tens of thousands of triples. Just in case

how to change when the logging module creates the log file?

2010-01-06 Thread Chris Colbert
I have an application the writes to a log file when specific exceptions are handled. However, if no exceptions are encountered, I don't want to create a log at all. The problem I am running into is that the stdlib logging module creates the log file immediately upon logger instantiation. Thus:

Re: how to change when the logging module creates the log file?

2010-01-06 Thread Chris Colbert
i was able to fix the exception by calling logging.shutdown() before the call to os.remove(). However, I still think there is probably a more elegant solution. On Wed, Jan 6, 2010 at 12:57 PM, Chris Colbert sccolb...@gmail.com wrote: I have an application the writes to a log file when specific

Re: ANN: Pymazon 0.1beta released.

2010-01-04 Thread Chris Colbert
On Mon, Jan 4, 2010 at 11:43 AM, Tim Wintle tim.win...@teamrubber.comwrote: On Tue, 2009-12-29 at 19:44 +0100, Chris Colbert wrote: I'm happy to announce the first beta release of Pymazon: a Python implemented alternative to the Amazon mp3 downloader. Pymazon was created specifically

ANN: Pymazon 0.1beta released.

2009-12-29 Thread Chris Colbert
I'm happy to announce the first beta release of Pymazon: a Python implemented alternative to the Amazon mp3 downloader. Pymazon was created specifically to alleviate the issues surrounding the Linux version of the Amazon mp3 downloader (though it should run just fine in Windows too). Pymazon can

a python downloader for the Amazon mp3 store

2009-12-19 Thread Chris Colbert
So, I wasn't happy with the Amazon mp3 downloader for linux (because it sucks). And clamz is written in C with a bunch of dependencies. Thus, I've created a python downloader for .amz files using the crypto keys figured out by Ben Moody (clamz author). Its just command line only right now, but I

doing cool stuff with Python and Industrial Robots....

2009-12-19 Thread Chris Colbert
Im just finishing up some research work during a stint as a visiting researcher in Germany. I've made a short clip showing a KUKA robot performing object reconstruction using a single camera mounted on the robot. The entire system is written in Python (control, math, everything) and related

Re: relative imports with the __import__ function

2009-12-09 Thread Chris Colbert
On Tue, Dec 8, 2009 at 5:48 PM, Peter Otten __pete...@web.de wrote: Chris Colbert wrote: I have package tree that looks like this: main.py package __init__.py configuration.ini server __init__.py xmlrpc_server.py controller.py reco

relative imports with the __import__ function

2009-12-08 Thread Chris Colbert
I have package tree that looks like this: main.py package __init__.py configuration.ini server __init__.py xmlrpc_server.py controller.py reco irrelevant.py's segmentation __init__.py red_objects.py other irrelevant

why do I get this behavior from a while loop?

2009-11-27 Thread S. Chris Colbert
This seems strange to me, but perhaps I am just missing something: In [12]: t = 0. In [13]: time = 10. In [14]: while t time: : print t : t += 1. : : 0.0 1.0 2.0

Re: why do I get this behavior from a while loop?

2009-11-27 Thread S. Chris Colbert
What a newbie mistake for me to make. I appreciate the replies everyone! Cheers, Chris On Fri, 27 Nov 2009 17:06:44 +0100, S. Chris Colbert wrote: I would think that second loop should terminate at 9.9, no? I am missing something fundamental? What Every Computer Scientist Should Know

Re: IDLE python shell freezes after running show() of matplotlib

2009-10-28 Thread Chris Colbert
This is a threading issue that is very common when using gui toolkits with the interactive interpreter. You're better off just using ipython, which already has builtin support for matplotlib when you start it via ipython -pylab On Wed, Oct 28, 2009 at 7:41 PM, OKB (not okblacke)

Re: calling server side function

2009-10-28 Thread Chris Colbert
I second the suggestion for XML-RPC... It also solves the security issue in your example, by only exporting functions you specifically register... look at xmlrpclib in the standard python library. On Wed, Oct 28, 2009 at 8:59 AM, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Wed, 28 Oct

does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
Say I use python to talk to a wireless webcamera that delivers images via http requests. I request an image and read it into a buffer, but the image is in jpeg format. I would like to convert this to a simple RGB format buffer to pass to numpy. Has anyone managed this using libjpeg or any other

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
, 1024, 3) In [15]: numpyimg.dtype Out[15]: dtype('uint8') On Tue, Oct 13, 2009 at 11:51 AM, Chris Colbert sccolb...@gmail.com wrote: Say I use python to talk to a wireless webcamera that delivers images via http requests. I request an image and read it into a buffer, but the image is in jpeg

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
Heh, for whatever reason, your post is dated earlier than my response, but wasn't here when I sent mine. But yeah, PIL worked. On Tue, Oct 13, 2009 at 12:04 PM, Stefan Behnel stefan...@behnel.de wrote: Chris Colbert wrote: Say I use python to talk to a wireless webcamera that delivers images

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
My emails must not be making it to list... I posted a solutions about 10 minutes after I posted the questions. Thanks! On Tue, Oct 13, 2009 at 12:35 PM, Dave Angel da...@ieee.org wrote: Chris Colbert wrote: Say I use python to talk to a wireless webcamera that delivers images via http

Re: how to use WSGI applications with apache

2009-10-07 Thread Chris Colbert
if you want to use it with apapache, you need mod_wsgi. If you want a pure python solution, you can use the wsgi server that comes with CherryPy. Personally, I use the wsgi server in CherrPy on my website. My site is not large by any means and the ease of deployment completely erased any benefit

Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
I have an application that needs to run different depending on whether the input data is being simulated, or provided from instrumentation. I am trying to abstract this machinery in a single class called Controller which I want to inherit from either SimController or RealController based on

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
= testcontroller.Controller() In [8]: c.foo() baz On Mon, Oct 5, 2009 at 3:32 PM, MRAB pyt...@mrabarnett.plus.com wrote: Chris Colbert wrote: I have an application that needs to run different depending on whether the input data is being simulated, or provided from instrumentation. I am trying to abstract

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
, and the controller takes care of it... On Mon, Oct 5, 2009 at 3:44 PM, Richard Brodie r.bro...@rl.ac.uk wrote: Chris Colbert sccolb...@gmail.com wrote in message news:mailman.868.1254748945.2807.python-l...@python.org... I am trying to abstract this machinery in a single class called

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
I suppose i can just move the SIMULATION flag to another module, and then import it and check it before intstantiation. So, the arg parser will have to set the flag before any other processing begins... On Mon, Oct 5, 2009 at 3:49 PM, Chris Colbert sccolb...@gmail.com wrote: I dont think so

Re: Python shared lib

2009-10-04 Thread Chris Colbert
thats because the standard way to build python packaged is to use distutils, and not make files. Blame Yafaray for not supplying a setup.py... ..M, Aahz a...@pythoncraft.com wrote: In article h9p9mp$2cv...@adenine.netfront.net, namekuseijin  namekuseijin.nos...@gmail.com wrote: and then I

Re: easy question, how to double a variable

2009-10-02 Thread Chris Colbert
I come from a scientific background, so my approach to the solution of this problem is a little different. It makes use of some numerical approximations, but that's not necessarily a bad thing, because it helps avoid singularities. So it could be a little more robust than other solutions

Re: unpacking vars from list of tuples

2009-09-17 Thread Chris Colbert
if you have numpy installed: ln[12]: import numpy as np In [13]: k = np.array([('a', 'bob', 'c'), ('p', 'joe', 'd'), ('x', 'mary', 'z')]) In [14]: k Out[14]: array([['a', 'bob', 'c'], ['p', 'joe', 'd'], ['x', 'mary', 'z']], dtype='|S4') In [15]: k[:,1] Out[15]:

Re: Looking for a pure Python chart drawing module

2009-09-17 Thread Chris Colbert
by your definitions, Python is just a wrapper around a C library. If none of the solutions work for you, roll your own. On Thu, Sep 17, 2009 at 11:38 AM, Giacomo Boffi giacomo.bo...@polimi.it wrote: John Nagle na...@animats.com writes: gerlos wrote: John Nagle ha scritto: I'm looking for

Re: Accessing objects at runtime.

2009-09-14 Thread Chris Colbert
why not just pawn your processing loop off onto a child thread and give yourself a hook (function) that you can call that return whatver info you what. Run the script in ipython, problem solved. On Mon, Sep 14, 2009 at 7:57 AM, jacopo jacopo.pe...@gmail.com wrote:    You might consider running

Re: Why use locals()

2009-09-14 Thread Chris Colbert
Given that python is devoid of types: Is the variable 'a' an int or a float at runtime?, explicit can only be taken so far. Personally, I use locals() when I work with Django. On Mon, Sep 14, 2009 at 7:42 AM, Sean DiZazzo half.ital...@gmail.com wrote: If you are willing to open your mind to

Re: IDE for Python

2009-08-31 Thread Chris Colbert
I'm a big fan of wing. Pay for the non-free version and you get all the goodies, plus PHENOMENAL support. Really. They answer support emails within a few minutes. Its has the best code completion i've seen in any python editor/ide and is also the most stable, fastest (for ide's), and

Re: Permanently adding to the Python path in Ubuntu

2009-08-30 Thread Chris Colbert
name is Steven! Cheers, Chris On Sat, Aug 29, 2009 at 11:51 PM, Sean DiZazzohalf.ital...@gmail.com wrote: On Aug 29, 5:39 pm, Chris Colbert sccolb...@gmail.com wrote: I'm having an issue with sys.path on Ubuntu. I want some of my home built packages to overshadow the system packages. Namely, I

Re: Permanently adding to the Python path in Ubuntu

2009-08-30 Thread Chris Colbert
Great! That was the solution I was looking for. Thanks! Chris On Sun, Aug 30, 2009 at 12:29 PM, Christian Heimesli...@cheimes.de wrote: Chris Colbert wrote: Is there a way to fix this so that the local dist-packages is added to sys.path before the system directory ALWAYS? I can do

Permanently adding to the Python path in Ubuntu

2009-08-29 Thread Chris Colbert
I'm having an issue with sys.path on Ubuntu. I want some of my home built packages to overshadow the system packages. Namely, I have built numpy 1.3.0 from source with atlas support, and I need it to overshadow the system numpy 1.2.1 which I had to drag along as a dependency for other stuff. I