unittest, order of test execution

2009-01-26 Thread mk
Hello everyone, I've got 2 functions to test, extrfromfile which returns a list of dictionaries, and extrvalues that extracts values from that list. Now I can test them both in one test case, like this: def test_extrfromfile(self): valist = ma.extrfromfile('loadavg_unittest.txt')

Re: v = json.loads("{'test':'test'}")

2009-01-26 Thread Ivan Illarionov
Diez wrote: > gert schrieb: > > Single quotes works in every browser that support json so i > > recommended python should support it too, besides it looks much > > cleaner > > {'test': 'test'} > > {"test": "test"} > > > It can not be that hard to support both notation can it ? > > It's not hard, bu

Re: USB in python

2009-01-26 Thread Lie Ryan
On Fri, 23 Jan 2009 18:56:38 +1100, Astan Chee wrote: > Diez B. Roggisch wrote: >>> >>> >> If all you need is on-off - why can't you just use a switch? >> >> >> > Because I want to control the on-off the device using a computer and > write software for it (which I am confident I can do i

Re: USB in python

2009-01-26 Thread Banibrata Dutta
high pitch is == high frequency, no higher amplitude... but the difference can be easily made out and the electronics for this is very well understood and used.point is, the gentleman asking the question might already have a USB controller built into his device, and while most modern computers have

Function arguments

2009-01-26 Thread brasse
Hello! Is there any way that I can get at all the arguments passed to a function as a map without using keyword arguments? def foo(a, b, c): # Can I access all the arguments in a collection somewhere? I'm mainly curious since I have stumbled on to some cases where it might have been nice to

Re: v = json.loads("{'test':'test'}")

2009-01-26 Thread Diez B. Roggisch
gert schrieb: On Jan 26, 12:40 am, "Diez B. Roggisch" wrote: But all of this is not JSON. Yes it is, you just make it more python dictionary compatible :) No, what you do is to make it more incompatible with other json-implementations. Which defies the meaning of a standard. Besides, {foo :

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Bruno Desthuilliers
Russ P. a écrit : On Jan 23, 4:57 am, Bruno Desthuilliers wrote: Russ P. a écrit : As I said before, if you have the source code you can always change private attributes to public in a pinch if the language enforces encapsulation. And then have to maintain a fork. No, thanks. For crying o

Re: Function arguments

2009-01-26 Thread Erik Max Francis
brasse wrote: Is there any way that I can get at all the arguments passed to a function as a map without using keyword arguments? def foo(a, b, c): # Can I access all the arguments in a collection somewhere? I'm mainly curious since I have stumbled on to some cases where it might have been

Re: Function arguments

2009-01-26 Thread Chris Rebert
On Mon, Jan 26, 2009 at 1:03 AM, brasse wrote: > Hello! > > Is there any way that I can get at all the arguments passed to a > function as a map without using keyword arguments? > > def foo(a, b, c): ># Can I access all the arguments in a collection somewhere? You can use positional arguments

Re: Function arguments

2009-01-26 Thread Diez B. Roggisch
brasse schrieb: Hello! Is there any way that I can get at all the arguments passed to a function as a map without using keyword arguments? def foo(a, b, c): # Can I access all the arguments in a collection somewhere? I'm mainly curious since I have stumbled on to some cases where it might

Re: Function arguments

2009-01-26 Thread brasse
On Jan 26, 10:11 am, Chris Rebert wrote: > On Mon, Jan 26, 2009 at 1:03 AM, brasse wrote: > > Hello! > > > Is there any way that I can get at all the arguments passed to a > > function as a map without using keyword arguments? > > > def foo(a, b, c): > >    # Can I access all the arguments in a c

Re: Function arguments

2009-01-26 Thread Chris Rebert
On Mon, Jan 26, 2009 at 1:34 AM, brasse wrote: > On Jan 26, 10:11 am, Chris Rebert wrote: >> On Mon, Jan 26, 2009 at 1:03 AM, brasse wrote: >> > Hello! >> >> > Is there any way that I can get at all the arguments passed to a >> > function as a map without using keyword arguments? >> >> > def foo

Re: ob_type in shared memory

2009-01-26 Thread Aaron Brady
Hi Mark, nice to have your comment. On Jan 25, 9:47 pm, Mark Wooding wrote: > Aaron Brady writes: snip > > Object 'A' is of type 'Ta'.  When process 'P' is looking at it, it > > needs to have an 'ob_type' that is 'Ta' as process 'P' sees it.  When > > process 'Q' is looking at it, it needs to ha

Ldap Extended Operation python

2009-01-26 Thread Benny Fallica
Hello there, what would be the python implementation for this line in Java: java.util.Hashtable environment = LdapHelper.getEnvironment(url, true); LdapContext ldapContext = new InitialLdapContext(environment, null); Response resp = (Response) ldapContext.extendedOperation(new Request()) how to

Re: Dynamic methods and lambda functions

2009-01-26 Thread Mark Wooding
Michael Torrie writes: > Basically, don't use a lambda. Create a real, local closure with a > nested def block. That way the closure is created every time the > parent function is called. Nope. I explained the real problem quite clearly, and it's to do with the difference between binding and

Re: Counting number of objects

2009-01-26 Thread Andreas Waldenburger
On Mon, 26 Jan 2009 02:37:37 + Mark Wooding wrote: > > This looks OK, although I'd suggest using "cls.counter += 1" instead > > of "a.counter += 1" in the __new__() method. Just seems clearer to > > me, esp. when you think about subclassing. > > I'm not sure about clarity, but that would be

Re: *.python.org broken?

2009-01-26 Thread Carlos Ribeiro
I experienced the same problem here in Brazil. Tweeks ago I could not access any *.python.org site. Today I tried and it worked. The problem seemed to be limited to Python's domain because I could access every other site that I tried the same day. More info: - At least for me I didn't seem to be I

Re: Python C API (PyObject_CallMethod clear object)

2009-01-26 Thread googler . 1 . webmaster
On 26 Jan., 03:25, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:46:01 -0200,   > escribió: > > > > > I have a problm with deallocating stuff. I call a function with this > > command: > > > PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); > > > if(rvalue==NULL) > >     PyErr_

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Tim Rowe
2009/1/25 Tim Chase : > (again, a malformed text-file with no terminal '\n' may cause it > to be absent from the last line) Ahem. That may be "malformed" for some specific file specification, but it is only "malformed" in general if you are using an operating system that treats '\n' as a terminat

Re: A java hobbyist programmer learning python

2009-01-26 Thread Tim Rowe
> I like the latter two styles, particularly the last one. That way you > can see at a glance that those member variables are defined in the > super class. I like the second style because it makes it leaves the 2-d implementation hidden, which is the whole point of encapsulation. > But then I am

Re: Python C API (PyObject_CallMethod clear object)

2009-01-26 Thread googler . 1 . webmaster
the hook is, how to delete the locals of this function, maybe thats a workaround? thanks and bye. -- http://mail.python.org/mailman/listinfo/python-list

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Bruno Desthuilliers
Russ P. a écrit : On Jan 23, 6:36 pm, Luis Zarrabeitia wrote: Makes *no* sense? There's *no* good reason *at all* for the original author to hide or protect internals? My bad, sorry. It makes sense... if the original author is an egotist who believes he must control how I use that library.

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Sion Arrowsmith
Diez B. Roggisch wrote: > [ ... ] Your approach of reading the full contents can be >used like this: > >content = a.read() >for line in content.split("\n"): > print line > Or if you want the full content in memory but only ever access it on a line-by-line basis: content = a.readlines() (Ju

Re: strange error whilst porting to 2.6

2009-01-26 Thread Robin Becker
I found that this error Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in ignored occurs when attempting to copy (copy.copy(inst)) an instance of a class that looks like this class LazyParagraph(_LazyMixin,TTParagraph): SUPER=TTParagraph _CL

Re: Ldap Extended Operation python

2009-01-26 Thread Michael Ströder
Benny Fallica wrote: > Hello there, > > what would be the python implementation for this line in Java: > > > java.util.Hashtable environment = LdapHelper.getEnvironment(url, true); > LdapContext ldapContext = new InitialLdapContext(environment, null); > Response resp = (Response) ldapContext.ext

Re: is None vs. == None

2009-01-26 Thread Steve Holden
Terry Reedy wrote: > Roger wrote: >>> And, just for completeness, the "is" test is canonical precisely because >>> the interpreter guarantees there is only ever one object of type None, >>> so an identity test is always appropriate. Even the copy module doesn't >>> create copies ... >>> >> >> Does

Re: Counting number of objects

2009-01-26 Thread Steve Holden
Mark Wooding wrote: > Andreas Waldenburger writes: > >> On Sun, 25 Jan 2009 09:23:35 -0800 (PST) Kottiyath >> wrote: >> >>> class a(object): >>> counter = 0 >>> def __new__(cls, *args, **kwargs): >>> a.counter += 1 >>> return object.__new__(cls, *args, **kwargs) > > Hmm.

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Steve Holden
Bruno Desthuilliers wrote: > Russ P. a écrit : >> On Jan 23, 6:36 pm, Luis Zarrabeitia wrote: >> Makes *no* sense? There's *no* good reason *at all* for the original author to hide or protect internals? >>> My bad, sorry. >>> It makes sense... if the original author is an egotist who bel

Re: Dynamic methods and lambda functions

2009-01-26 Thread Steve Holden
Mark Wooding wrote: > unine...@gmail.com writes: [...] > * Assignment stores a new (reference to a) value in the variable. > > * Binding modifies the mapping between names and variables. > I realise I have omitted what was doubtless intended to be explanatory detail, but I am having trouble r

Building matplotlib from source on windows

2009-01-26 Thread mk
Hello everyone, I'm trying to get 0.98.5.2 installed on Windows to use Python 2.6 (dependency packages I need to use on that version, long story, etc). When I was trying to build it (python setup.py build), it was finding the VC 9.0 C++ compiler on my comp. However, after adding necessary pa

Re: USB in python

2009-01-26 Thread Steve Holden
Lie Ryan wrote: > On Fri, 23 Jan 2009 18:56:38 +1100, Astan Chee wrote: > >> Diez B. Roggisch wrote: >>> If all you need is on-off - why can't you just use a switch? >>> >>> >>> >> Because I want to control the on-off the device using a computer and >> write software for it (wh

Re: USB in python

2009-01-26 Thread Steve Holden
Astan Chee wrote: > Tim Roberts wrote: >> Sorry, but you have NOT created a USB device, and I sincerely hope you do >> not try to plug it in to a real USB port. >> > Sorry, by USB device, I meant a device that is powered/activated by a > bunch of wires that I want to control using a computer and

Re: I'm a python addict !

2009-01-26 Thread J Kenneth King
Linuxguy123 writes: > I just started using python last week and I'm addicted. > > I hate Perl. I never did learn to use it with any competence. I has to > be the most obfuscated, cryptic language I've ever seen. Making it > "object oriented" only makes it worse ! > .. .. I program full-time

Re: I'm a python addict !

2009-01-26 Thread J Kenneth King
J Kenneth King writes: > Linuxguy123 writes: > >> I just started using python last week and I'm addicted. >> >> I hate Perl. I never did learn to use it with any competence. I has to >> be the most obfuscated, cryptic language I've ever seen. Making it >> "object oriented" only makes it worse

Re: Function arguments

2009-01-26 Thread brasse
On Jan 26, 10:39 am, Chris Rebert wrote: > On Mon, Jan 26, 2009 at 1:34 AM, brasse wrote: > > On Jan 26, 10:11 am, Chris Rebert wrote: > >> On Mon, Jan 26, 2009 at 1:03 AM, brasse wrote: > >> > Hello! > > >> > Is there any way that I can get at all the arguments passed to a > >> > function as a

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Marc 'BlackJack' Rintsch
On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote: > content = a.readlines() > > (Just because we can now write "for line in file" doesn't mean that > readlines() is *totally* redundant.) But ``content = list(a)`` is shorter. :-) Ciao, Marc 'BlackJack' Rintsch -- http://mail.py

Re: USB in python

2009-01-26 Thread Brian Allen Vanderburg II
astan.c...@al.com.au wrote: Tim Roberts wrote: Sorry, but you have NOT created a USB device, and I sincerely hope you do not try to plug it in to a real USB port. Sorry, by USB device, I meant a device that is powered/activated by a bunch of wires that I want to control using a computer and

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Andreas Waldenburger
On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch wrote: > On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote: > > > content = a.readlines() > > > > (Just because we can now write "for line in file" doesn't mean that > > readlines() is *totally* redundant.) > > But ``content = list(a

really slow gzip decompress, why?

2009-01-26 Thread redbaron
I've one big (6.9 Gb) .gz file with text inside it. zcat bigfile.gz > /dev/null does the job in 4 minutes 50 seconds python code have been doing the same job for 25 minutes and still doesn't finish =( the code is simpliest I could ever imagine: def main(): fh = gzip.open(sys.argv[1]) all(fh)

Re: Newby: how to transform text into lines of text

2009-01-26 Thread J. Cliff Dyer
On Sun, 2009-01-25 at 18:23 -0800, John Machin wrote: > On Jan 26, 1:03 pm, "Gabriel Genellina" > wrote: > > En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase > > escribió: > > > > > > > > > Unfortunately, a raw rstrip() eats other whitespace that may be > > > important. I frequently get tab-de

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Paul Rubin
Steve Holden writes: > Quite. Python is a language "for consenting adults". Shouldn't such a language allow consenting adults to enter a BDSM scene without being moralized at, if that's what they want to do? ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: strange error whilst porting to 2.6

2009-01-26 Thread Robin Becker
Robin Becker wrote: I found that this error Exception RuntimeError: 'maximum recursion depth exceeded in __subclasscheck__' in ignored occurs when attempting to copy (copy.copy(inst)) an instance of a class that looks like this class LazyParagraph(_LazyMixin,TTParagraph): SUPER=TTPar

Re: really slow gzip decompress, why?

2009-01-26 Thread Diez B. Roggisch
redbaron wrote: > I've one big (6.9 Gb) .gz file with text inside it. > zcat bigfile.gz > /dev/null does the job in 4 minutes 50 seconds > > python code have been doing the same job for 25 minutes and still > doesn't finish =( the code is simpliest I could ever imagine: > > def main(): > fh =

AttributeError: 'module' object has no attribute 'open_workbook'

2009-01-26 Thread Jay Jesus Amorin
Hi, Kindly help, I've got this error when running my script: AttributeError: 'module' object has no attribute 'open_workbook' Here's my code: #!/usr/bin/python import xlrd import sys mySpreadsheet = xlrd.open_workbook(open(sys.argv[1])) firstSheet = wb.sheet_by_index(0) for myRows in range(

Re: really slow gzip decompress, why?

2009-01-26 Thread Jeff McNeil
On Jan 26, 10:22 am, redbaron wrote: > I've one big (6.9 Gb) .gz file with text inside it. > zcat bigfile.gz > /dev/null does the job in 4 minutes 50 seconds > > python code have been doing the same job for 25 minutes and still > doesn't finish =( the code is simpliest I could ever imagine: > > de

Re: really slow gzip decompress, why?

2009-01-26 Thread Jeff McNeil
On Jan 26, 10:51 am, Jeff McNeil wrote: > On Jan 26, 10:22 am, redbaron wrote: > > > I've one big (6.9 Gb) .gz file with text inside it. > > zcat bigfile.gz > /dev/null does the job in 4 minutes 50 seconds > > > python code have been doing the same job for 25 minutes and still > > doesn't finish

Re: AttributeError: 'module' object has no attribute 'open_workbook'

2009-01-26 Thread MRAB
Jay Jesus Amorin wrote: > Hi, > > Kindly help, I've got this error when running my script: > > AttributeError: 'module' object has no attribute 'open_workbook' > > > Here's my code: > > #!/usr/bin/python > > import xlrd > import sys > > mySpreadsheet = xlrd.open_workbook(open(sys.argv[1])) > first

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Tim Rowe
2009/1/26 Paul Rubin <"http://phr.cx"@nospam.invalid>: > Steve Holden writes: >> Quite. Python is a language "for consenting adults". > > Shouldn't such a language allow consenting adults to enter a BDSM > scene without being moralized at, if that's what they want to do? ;-) The language doesn't

Problem with Nose testing until forking process

2009-01-26 Thread Jan Koprowski
Hi ! I write application witch sometimes need fork to shell based process (some kind of shell command). I snatch stdin, stdout, stderr and two additional streams and fork process to run command and get results. # -*- encoding: utf-8 -*- import os import sys import subprocess def pipes_functio

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Steve Holden
Paul Rubin wrote: > Steve Holden writes: >> Quite. Python is a language "for consenting adults". > > Shouldn't such a language allow consenting adults to enter a BDSM > scene without being moralized at, if that's what they want to do? ;-) Yes, but you know what moralizers are like ... regards

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Mon, 2009-01-26 at 14:43 -0800, J Kenneth King wrote: > Linuxguy123 writes: > > > I just started using python last week and I'm addicted. > > > > I hate Perl. I never did learn to use it with any competence. I has to > > be the most obfuscated, cryptic language I've ever seen. Making it >

Web services

2009-01-26 Thread loial
I am trying to learn about web services and how to interface with a 3rd party web service from python. Can anyone point me at an idiots guide/tutorial for someone who is new to web services? -- http://mail.python.org/mailman/listinfo/python-list

Method returning an Iterable Object

2009-01-26 Thread Anjanesh Lekshminarayanan
Is there a way to return an iterable object ? class twoTimes: def __init__(self, n): self.__n = n def getNext(): self.__n *= 2 return self.__n t = twoTimes(5) while (n in t.getNext()): # while (n in t): print (n) -- Anjanesh Lekshmnarayanan -- http://mail.p

Re: Method returning an Iterable Object

2009-01-26 Thread Steve Holden
Anjanesh Lekshminarayanan wrote: > Is there a way to return an iterable object ? > > class twoTimes: > def __init__(self, n): > self.__n = n > > def getNext(): > self.__n *= 2 > return self.__n > > > t = twoTimes(5) > while (n in t.getNext()): # while (n in t): >

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: > Want to change the type/behavior of an object from class A to class > B? How about this: > > aobj = A() > aobj.__class__ = B > > Try *that* in as simple-looking C++ or Java! Wow. That looks very powerful and fun. But scary. An

Re: Method returning an Iterable Object

2009-01-26 Thread Andreas Waldenburger
On Mon, 26 Jan 2009 22:01:21 +0530 Anjanesh Lekshminarayanan wrote: > Is there a way to return an iterable object ? > > class twoTimes: > def __init__(self, n): > self.__n = n > > def getNext(): > self.__n *= 2 > return self.__n > > Rename getNext() to next() a

Re: USB in python

2009-01-26 Thread Grant Edwards
On 2009-01-26, Lie Ryan wrote: > How about (a crazy idea) using the audio jack out? (DISCLAIMER: Little > Hardware Experience). High pitched sound (or anything in sound-ology that > means high voltage) means the device is on and low pitched sound off. 1) Pitch has nothing to do with voltage.

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Bruno Desthuilliers
Russ P. a écrit : (snip) You are trying to dictate that the library implementer not be allowed to use enforced access restriction. And, in the larger sense, you are trying to dictate that access restrictions not be enforced in Python. FWIW, it's actually *you* who are trying to dictate that acc

Re: What is intvar? [Python Docs]

2009-01-26 Thread W. eWatson
r wrote: W. eWatson, I contacted the author of New Mexico Techs "Introduction to Tkinter" a couple of weeks ago. He is going to update the reference material with a few missing widgets and some info on Photo and Bitmap classes. I really love the NMT layout and use it quite often. Fredricks Tkint

Re: Python C API (PyObject_CallMethod clear object)

2009-01-26 Thread Gabriel Genellina
En Mon, 26 Jan 2009 08:47:31 -0200, escribió: On 26 Jan., 03:25, "Gabriel Genellina" wrote: En Sun, 25 Jan 2009 23:46:01 -0200, escribió: > I have a problm with deallocating stuff. I call a function with this > command: > PyObject *rvalue = PyObject_CallMethod(obj, "execute","",NULL); >

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Gabriel Genellina
En Mon, 26 Jan 2009 13:35:39 -0200, J. Cliff Dyer escribió: On Sun, 2009-01-25 at 18:23 -0800, John Machin wrote: On Jan 26, 1:03 pm, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase > escribió: > > I suppose if I were really smart, I'd dig a little deeper in the

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Gabriel Genellina
En Mon, 26 Jan 2009 13:35:39 -0200, J. Cliff Dyer escribió: On Sun, 2009-01-25 at 18:23 -0800, John Machin wrote: On Jan 26, 1:03 pm, "Gabriel Genellina" wrote: > En Sun, 25 Jan 2009 23:30:33 -0200, Tim Chase > escribió: > > I suppose if I were really smart, I'd dig a little deeper in the

Re: Web services

2009-01-26 Thread Chris Rebert
On Mon, Jan 26, 2009 at 8:11 AM, loial wrote: > I am trying to learn about web services and how to interface with a > 3rd party web service from python. > > Can anyone point me at an idiots guide/tutorial for someone who is new > to web services? The XML-RPC client module in the std lib (xmlrpcli

Re: I'm a python addict !

2009-01-26 Thread Paul McGuire
On Jan 26, 10:54 am, "J. Cliff Dyer" wrote: > On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: > > Want to change the type/behavior of an object from class A to class > > B?  How about this: > > >     aobj = A() > >     aobj.__class__ = B > > > Try *that* in as simple-looking C++ or Java! >

Process crash with no reason

2009-01-26 Thread gil . shinar
Hi All, I'm running a program that is acting as a nice interface to sybase' replication server. The program is using the cherrypy web service for the GUI. The process is crashing every few days with no reason. In the log I can see INFO and DEBUG (No ERROR) log lines and I do not get any TraceBack

Re: Dynamic methods and lambda functions

2009-01-26 Thread Kay Schluehr
On 26 Jan., 15:13, Steve Holden wrote: > Mark Wooding wrote: > > unine...@gmail.com writes: > [...] > > * Assignment stores a new (reference to a) value in the variable. > > > * Binding modifies the mapping between names and variables. > > I realise I have omitted what was doubtless intended t

unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
Hi, while checking out Python 3, I read that all text strings are now natively Unicode. In the Python language reference (http://docs.python.org/3.0/reference/ lexical_analysis.html) I read that I can show Unicode character in several ways. "\u" supposedly allows me to specify the Unicode chara

Re: Method returning an Iterable Object

2009-01-26 Thread Anjanesh Lekshminarayanan
> You can also replace the whole class with a function thusly: > >def two_times(n): >for k in itertools.count(1): >yield n * (2**k) > > This function is then called a generator (because it generates an > iterator). You can now say > >infinitely_doubling_numbers = two_tim

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin
Hmm this works for me, it's a self compiled version: ~ $ python3 Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print("\u20ac") € >>> print ("\N{EURO SIGN}") € >>> 2009/1/26 j

Re: Process crash with no reason

2009-01-26 Thread Philip Semanchuk
On Jan 26, 2009, at 1:13 PM, gil.shi...@gmail.com wrote: Hi All, I'm running a program that is acting as a nice interface to sybase' replication server. The program is using the cherrypy web service for the GUI. The process is crashing every few days with no reason. In the log I can see INFO a

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Benjamin Kaplan
On Mon, Jan 26, 2009 at 1:16 PM, jefm wrote: > Hi, > while checking out Python 3, I read that all text strings are now > natively Unicode. > In the Python language reference (http://docs.python.org/3.0/reference/ > lexical_analysis.html)

Python and CUDO

2009-01-26 Thread fredrik kant
Hi! Sorry about the misspelling, it should of course been "NIVIDAS CUDA". I also noticed that there wrappers around such as: pycuda which answers my question. -- Fredrik Kant Kant Consulting AB Mobile: +46 70 787 06 01 www.kantconsulting.se -- http://mail.python.org/mailman/listinfo/python-list

Re: v = json.loads("{'test':'test'}")

2009-01-26 Thread Miles
On Mon, Jan 26, 2009 at 4:06 AM, Diez B. Roggisch wrote: > There are people who say something along the lines of "be strict when > writing, and tolerant when reading" (the exact quote is different, but > neither google:~site:mybrain nor any other have helped me here) That's Postel's Law: http://en

Re: Plugin system, RuntimeWarning: Parent module 'ext_abc' not found while handling absolute import

2009-01-26 Thread Torsten Mohr
Hello, >> Basically, this here works but gives a warning: >> RuntimeWarning: Parent module 'ext_abc' not found while handling >> absolute import > > >> here = os.path.abspath('.') > > (Unrelated to the main question, but you probably want to use > os.path.dirname(os.path.abspath(__file__)) inst

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
>Hmm this works for me, >it's a self compiled version: >~ $ python3 >Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) >[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 You are running on Linux. Mine is on Windows. Anyone else have this issue on Windows ? -- http://mail.python.org/mailman/listinfo/pytho

Re: A java hobbyist programmer learning python

2009-01-26 Thread Scott David Daniels
Tim Rowe wrote: ... I like the second style because it makes it leaves the 2-d implementation hidden, which is the whole point of encapsulation. I like the second as well, in that it it allows the parent to update any related data structures (for example, updating a display). However, I am a bi

Re: Method returning an Iterable Object

2009-01-26 Thread Andreas Waldenburger
On Tue, 27 Jan 2009 00:05:53 +0530 Anjanesh Lekshminarayanan wrote: > > You can also replace the whole class with a function thusly: > > > >def two_times(n): > >for k in itertools.count(1): > >yield n * (2**k) > > > > This function is then called a generator (because it ge

Re: I'm a python addict !

2009-01-26 Thread Scott David Daniels
J. Cliff Dyer wrote: On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: ... How about this: aobj = A() aobj.__class__ = B ... Wow. That looks very powerful and fun. But scary. Any thoughts on how you would use that in a way that wouldn't unleash sulphurous code smells? Seems li

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Mon, 2009-01-26 at 09:52 -0800, Paul McGuire wrote: > On Jan 26, 10:54 am, "J. Cliff Dyer" wrote: > > On Fri, 2009-01-23 at 20:25 -0800, Paul McGuire wrote: > > > Want to change the type/behavior of an object from class A to class > > > B? How about this: > > > > > aobj = A() > > > ao

Anoying unicode / str conversion problem

2009-01-26 Thread Hans Müller
Hi python experts, in the moment I'm struggling with an annoying problem in conjunction with mysql. I'm fetching rows from a database, which the mysql drive returns as a list of tuples. The default coding of the database is utf-8. Unfortunately in the database there are rows with different cod

Re: Does Python really follow its philosophy of "Readability counts"?

2009-01-26 Thread Russ P.
On Jan 26, 1:07 am, Bruno Desthuilliers wrote: > No. I can change the *team's* code. Please *read*. "team's ownership", > ok ? Or do I have to spell it out loud ? TEAM'S OWNERSHIP. Uh. You get > the message, now ? Team ownership doesn't necessarily mean that you can just change code at will. In

Re: is None vs. == None

2009-01-26 Thread Terry Reedy
Steve Holden wrote: Terry Reedy wrote: In 2.x, the *names* 'True' and 'False' can be rebound because bool is new and people write try: False,True except NameError: False,True = 0,1 to make code back compatible. I would claim that the ability to rebind True and False is a simple bug, tho

Re: I'm a python addict !

2009-01-26 Thread Paul McGuire
On Jan 26, 2:06 pm, "J. Cliff Dyer" wrote: > > Thanks.  That makes sense.  But your example creates a new instance of > the new class each time, rather than changing the class of a persistent > instance, as the original example, to which I was responding, did. > Look closer. The line that create

Re: Anoying unicode / str conversion problem

2009-01-26 Thread Benjamin Kaplan
On Mon, Jan 26, 2009 at 3:21 PM, Hans Müller wrote: > Hi python experts, > > in the moment I'm struggling with an annoying problem in conjunction with > mysql. > > I'm fetching rows from a database, which the mysql drive returns as a list > of tuples. > > The default coding of the database is utf

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Michael Torrie
jefm wrote: >> Hmm this works for me, >> it's a self compiled version: >> ~ $ python3 >> Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) >> [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 > > You are running on Linux. Mine is on Windows. > Anyone else have this issue on Windows ? As Benjamin Kaplin

Re: Monitor a FTP site for arrival of new/updated files

2009-01-26 Thread Giampaolo Rodola'
On 25 Gen, 21:11, Steve Holden wrote: > pyt...@bdurham.com wrote: > >  Any suggestions on a best practice way to monitor a remote FTP site for > > the arrival of new/updated files? I don't need specific code, just some > > coaching on technique based on your real-world experience including > > sug

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Terry Reedy
jefm wrote: Hi, while checking out Python 3, I read that all text strings are now natively Unicode. True In the Python language reference (http://docs.python.org/3.0/reference/ lexical_analysis.html) I read that I can show Unicode character in several ways. "\u" supposedly allows me to sp

Re: Pipe stdout && stderr to a TkLabel widget

2009-01-26 Thread rantingrick
OK, here is a simple example that will show you what i want to do. Right now if you type print 'hello' in the entry and press you will see braces in the label "{}". But if you type sys.stdou.write ("hello") you will see "{hello}" in the label. So i got the stdout piping to the widget now, but it w

Re: is None vs. == None

2009-01-26 Thread Steve Holden
Terry Reedy wrote: > Steve Holden wrote: >> Terry Reedy wrote: > >>> In 2.x, the *names* 'True' and 'False' can be rebound because bool is >>> new and people write >>> try: >>> False,True >>> except NameError: >>> False,True = 0,1 >>> >>> to make code back compatible. >>> >> I would claim that

Re: Anoying unicode / str conversion problem

2009-01-26 Thread Peter Otten
Hans Müller wrote: > Hi python experts, > > in the moment I'm struggling with an annoying problem in conjunction with > mysql. > > I'm fetching rows from a database, which the mysql drive returns as a list > of tuples. > > The default coding of the database is utf-8. > > Unfortunately in the d

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
>As Benjamin Kaplin said, Windows terminals use the old cp1252 character >set, which cannot display the euro sign. You'll either have to run it in > something more modern like the cygwin rxvt terminal, or output some >other way, such as through a GUI. >With the standard console, I get the same. B

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Jean-Paul Calderone
On Mon, 26 Jan 2009 13:26:56 -0800 (PST), jefm wrote: As Benjamin Kaplin said, Windows terminals use the old cp1252 character set, which cannot display the euro sign. You'll either have to run it in something more modern like the cygwin rxvt terminal, or output some other way, such as through a

Re: I'm a python addict !

2009-01-26 Thread J. Cliff Dyer
On Mon, 2009-01-26 at 12:37 -0800, Paul McGuire wrote: > On Jan 26, 2:06 pm, "J. Cliff Dyer" wrote: > > > > Thanks. That makes sense. But your example creates a new instance of > > the new class each time, rather than changing the class of a persistent > > instance, as the original example, to

Re: AttributeError: 'module' object has no attribute 'open_workbook'

2009-01-26 Thread John Machin
On Jan 27, 3:07 am, MRAB wrote: > Jay Jesus Amorin wrote: [snip] >  > Here's the error message: >  > >  > r...@nebuchadnezzar:/home/test/project# ./xlrd.py test.xls >  > Traceback (most recent call last): >  >   File "./xlrd.py", line 3, in >  >     import xlrd >  >   File "/home/jayam/project/xl

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
Now that I know the problem, I found the following on Google. Windows uses codepages to display different character sets. (http:// en.wikipedia.org/wiki/Code_page) The Windows chcp command allows you to change the character set from the original 437 set. When you type on the command line: chcp

Re: Anoying unicode / str conversion problem

2009-01-26 Thread Hans Müller
Thanks Peter, your answer did the trick. I programed a lot with awk (also a very cool scripting language). So I was focused on the concept a dictionary key has to be string (as in awk). Since it's impossible to use a list as a dictionary key I thought it's also impossible to use a tuple as a key.

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
chcp 1252 does allow me to print the EURO sign. Thanks for pointing that out. However, it does not show me some ALL Unicode characters. Very frustrating. I was hoping to find something that allows me to print any Unicode character on the console. -- http://mail.python.org/mailman/listinfo/python-li

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Marc 'BlackJack' Rintsch
On Mon, 26 Jan 2009 16:10:11 +0100, Andreas Waldenburger wrote: > On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch > wrote: > >> On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote: >> >> > content = a.readlines() >> > >> > (Just because we can now write "for line in file" doesn't me

scatterhist and resizing figures

2009-01-26 Thread perfreem
i am using scatterhist to plot some data. i find that when i plot the data and matlab shows it in the figure window, stretching the figure window (with the mouse) to enlarge it actually changes the properties of the figure. for example, making it bigger sometimes reveals more tick marks - like the

Re: Newby: how to transform text into lines of text

2009-01-26 Thread Andreas Waldenburger
On 26 Jan 2009 22:12:43 GMT Marc 'BlackJack' Rintsch wrote: > On Mon, 26 Jan 2009 16:10:11 +0100, Andreas Waldenburger wrote: > > > On 26 Jan 2009 14:51:33 GMT Marc 'BlackJack' Rintsch > > wrote: > > > >> On Mon, 26 Jan 2009 12:22:18 +, Sion Arrowsmith wrote: > >> > >> > content = a.readl

  1   2   >