Re: Python Style Question

2014-10-30 Thread Denis McMahon
On Fri, 31 Oct 2014 09:48:10 +1100, Steven D'Aprano wrote: > MRAB wrote: >> How about: >> >> int(str(obj).strip('"')) > > Absolutely not. > > obj = '""1\n\n\n\n' # not valid JSON load_int(obj) > => raises ValueError int(str(obj).strip('"')) > => wrongly returns 1 How about #!/us

Re: Python Style Question

2014-10-30 Thread Steven D'Aprano
Roy Smith wrote: > In article <54521c8f$0$12982$c3e8da3$54964...@news.astraweb.com>, > Steven D'Aprano wrote: > >> Anton wrote: >> >> > Let's say I have an incoming list of values *l*. Every element of *l* >> > can be one of the following options: >> > 1) an integer value >> > 2) a string in f

Re: set environmental variable from python

2014-10-30 Thread Zachary Ware
On Thu, Oct 30, 2014 at 9:40 PM, Artur Bercik wrote: > could you please elaborate 'setx <...>'? >From a Command Prompt, do 'help setx' for details on how to use setx. Rustom's suggestion of using regedit is going to be far easier than using _winreg (which probably shouldn't even be considered as

Re: set environmental variable from python

2014-10-30 Thread Rustom Mody
On Friday, October 31, 2014 7:33:43 AM UTC+5:30, Artur Bercik wrote: > Dear Dave Angel > > > Thanks for your answer. > > > I am using Python 2.7 > > > I want to set it permanently. > I have to set several variables so it would be easier if I could set them > from Python. regedit is scriptab

Re: set environmental variable from python

2014-10-30 Thread Artur Bercik
I have to set several variables so it would be easier if I could set them from Python. On Fri, Oct 31, 2014 at 11:36 AM, Rustom Mody wrote: > On Friday, October 31, 2014 8:01:08 AM UTC+5:30, Zachary Ware wrote: > > On Thursday, October 30, 2014, Artur Bercik wrote: > > > > Dear Dave Angel > > >

Re: set environmental variable from python

2014-10-30 Thread Artur Bercik
could you please elaborate 'setx <...>'? On Fri, Oct 31, 2014 at 11:30 AM, Zachary Ware < zachary.ware+pyl...@gmail.com> wrote: > On Thursday, October 30, 2014, Artur Bercik wrote: > >> Dear Dave Angel >> >> Thanks for your answer. >> >> I am using Python 2.7 >> >> I want to set it permanently.

Re: set environmental variable from python

2014-10-30 Thread Rustom Mody
On Friday, October 31, 2014 8:01:08 AM UTC+5:30, Zachary Ware wrote: > On Thursday, October 30, 2014, Artur Bercik wrote: > > Dear Dave Angel > > > Thanks for your answer. > > > I am using Python 2.7 > > > I want to set it permanently. > I have to set several variables so it would be easier

Re: set environmental variable from python

2014-10-30 Thread Zachary Ware
On Thursday, October 30, 2014, Artur Bercik wrote: > Dear Dave Angel > > Thanks for your answer. > > I am using Python 2.7 > > I want to set it permanently. > I have to set several variables so it would be easier if I could set them > from Python. > Depending on how "permanently" you mean, about

Re: set environmental variable from python

2014-10-30 Thread Artur Bercik
Dear Dave Angel Thanks for your answer. I am using Python 2.7 I want to set it permanently. I have to set several variables so it would be easier if I could set them from Python. Hearing the solution. On Fri, Oct 31, 2014 at 10:50 AM, Dave Angel wrote: > On 10/30/2014 09:22 PM, Artur Bercik

Re: Saving a file "in the background" -- How?

2014-10-30 Thread Terry Reedy
On 10/30/2014 6:21 PM, Joel Goldstick wrote: On Thu, Oct 30, 2014 at 5:30 PM, Virgil Stokes wrote: While running a python program I need to save some of the data that is being created. I would like to save the data to a file on a disk according to a periodical schedule (e.g. every 10 minutes).

Re: set environmental variable from python

2014-10-30 Thread Dave Angel
On 10/30/2014 09:22 PM, Artur Bercik wrote: I have to set environmental variable in my windows PC as follows: variable name: GISBASE value: C:\GRASS-64 Is it possible to set it from python? Which Python? I'll have to assume 3.x import sys sys.path.append("C:\\GRASS-64") But how to give

Re: Saving a file "in the background" -- How?

2014-10-30 Thread Deepfriedice
Why not just call the save function as a separate thread? threading.Thread(target=save, args=(data)).start() -- https://mail.python.org/mailman/listinfo/python-list

ANN: Antipathy v0.8

2014-10-30 Thread Ethan Furman
has just been made compatible with Python 3! It runs on everything from 2.4 forward, haven't testing anything prior to that. It is available for download at https://pypi.python.org//pypi/antipathy --- Antipathy -- for

Re: Classes

2014-10-30 Thread sohcahtoa82
On Thursday, October 30, 2014 2:37:54 PM UTC-7, Seymore4Head wrote: > On Thu, 30 Oct 2014 14:28:19 -0700, Larry Hudson > wrote: > > >On 10/30/2014 01:16 PM, Seymore4Head wrote: > >> class pet: > >> def set_age(self,age): > >> self.age=age > >> def get_age(self): > >> r

set environmental variable from python

2014-10-30 Thread Artur Bercik
I have to set environmental variable in my windows PC as follows: variable name: GISBASE value: C:\GRASS-64 Is it possible to set it from python? import sys sys.path.append("C:\\GRASS-64") But how to give variable name? I have to set both the variable name and value. Thanks in the advance.

Re: problem with pefile

2014-10-30 Thread Cameron Simpson
On 30Oct2014 17:58, Kiuhnm wrote: On Friday, October 31, 2014 1:33:07 AM UTC+1, Cameron Simpson wrote: On 29Oct2014 08:34, gandalf23 wrote: >OT: how can I hide my email in these posts? >Every time I try to send a post, google warns me that my email is visible and so I edit it out. Why would y

Re: problem with pefile

2014-10-30 Thread Kiuhnm
On Friday, October 31, 2014 1:33:07 AM UTC+1, Cameron Simpson wrote: > On 29Oct2014 08:34, gandalf23 wrote: > >OT: how can I hide my email in these posts? > >Every time I try to send a post, google warns me that my email is visible > >and so I edit it out. > > Why would you want to hide your emai

Re: Python Style Question

2014-10-30 Thread Roy Smith
In article <54521c8f$0$12982$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > Anton wrote: > > > Let's say I have an incoming list of values *l*. Every element of *l* can > > be one of the following options: > > 1) an integer value > > 2) a string in form of '', e.g. '7' > > 3) a

Re: problem with pefile

2014-10-30 Thread Cameron Simpson
On 29Oct2014 08:34, gandal...@mail.com wrote: OT: how can I hide my email in these posts? Every time I try to send a post, google warns me that my email is visible and so I edit it out. Why would you want to hide your email? Cameron Simpson -- https://mail.python.org/mailman/listinfo/python

Re: Python Style Question

2014-10-30 Thread Steven D'Aprano
MRAB wrote: > On 2014-10-30 11:10, Steven D'Aprano wrote: >> Anton wrote: >> >>> Let's say I have an incoming list of values *l*. Every element of *l* >>> can be one of the following options: >>> 1) an integer value >>> 2) a string in form of '', e.g. '7' >>> 3) a string with a json serialization

Re: Saving a file "in the background" -- How?

2014-10-30 Thread Joel Goldstick
On Thu, Oct 30, 2014 at 5:30 PM, Virgil Stokes wrote: > While running a python program I need to save some of the data that is being > created. I would like to save the data to a file on a disk according to a > periodical schedule (e.g. every 10 minutes). Initially, the amount of data > is small

Re: When using a decorator exceptions raised reference the decorator not the function

2014-10-30 Thread Néstor Boscán
Thanks Terry Yes both lines where in the traceback using tb_next I got what I needed. Regards, Néstor On Thu, Oct 30, 2014 at 1:36 PM, Terry Reedy wrote: > On 10/30/2014 8:33 AM, Néstor Boscán wrote: > > I'm using Python 2.7 and I'm creating a class decorator that extract >> information from

Saving a file "in the background" -- How?

2014-10-30 Thread Virgil Stokes
While running a python program I need to save some of the data that is being created. I would like to save the data to a file on a disk according to a periodical schedule (e.g. every 10 minutes). Initially, the amount of data is small (< 1 MB) but after sometime the amount of data can be >10MB

Re: Classes

2014-10-30 Thread Seymore4Head
On Thu, 30 Oct 2014 14:28:19 -0700, Larry Hudson wrote: >On 10/30/2014 01:16 PM, Seymore4Head wrote: >> class pet: >> def set_age(self,age): >> self.age=age >> def get_age(self): >> return self.age >> pax=pet >> pax.set_age(4) >> >> Traceback (most recent call last): >

Re: Classes

2014-10-30 Thread Larry Hudson
On 10/30/2014 01:16 PM, Seymore4Head wrote: class pet: def set_age(self,age): self.age=age def get_age(self): return self.age pax=pet pax.set_age(4) Traceback (most recent call last): File "C:\Functions\test.py", line 18, in pax.set_age(4) TypeError: set_age(

Re: Classes

2014-10-30 Thread Seymore4Head
On Thu, 30 Oct 2014 13:34:04 -0700, Rob Gaddi wrote: >On Thu, 30 Oct 2014 16:16:51 -0400 >Seymore4Head wrote: > >> class pet: >> def set_age(self,age): >> self.age=age >> def get_age(self): >> return self.age >> pax=pet >> pax.set_age(4) >> >> Traceback (most recent cal

Re: Classes

2014-10-30 Thread Seymore4Head
On Thu, 30 Oct 2014 13:33:01 -0700 (PDT), sohcahto...@gmail.com wrote: >On Thursday, October 30, 2014 1:19:57 PM UTC-7, Seymore4Head wrote: >> class pet: >> def set_age(self,age): >> self.age=age >> def get_age(self): >> return self.age >> pax=pet >> pax.set_age(4) >> >>

Re: Classes

2014-10-30 Thread sohcahtoa82
On Thursday, October 30, 2014 1:19:57 PM UTC-7, Seymore4Head wrote: > class pet: > def set_age(self,age): > self.age=age > def get_age(self): > return self.age > pax=pet > pax.set_age(4) > > Traceback (most recent call last): > File "C:\Functions\test.py", line 18, in >

Re: Classes

2014-10-30 Thread Rob Gaddi
On Thu, 30 Oct 2014 16:16:51 -0400 Seymore4Head wrote: > class pet: > def set_age(self,age): > self.age=age > def get_age(self): > return self.age > pax=pet > pax.set_age(4) > > Traceback (most recent call last): > File "C:\Functions\test.py", line 18, in > pax.se

Classes

2014-10-30 Thread Seymore4Head
class pet: def set_age(self,age): self.age=age def get_age(self): return self.age pax=pet pax.set_age(4) Traceback (most recent call last): File "C:\Functions\test.py", line 18, in pax.set_age(4) TypeError: set_age() missing 1 required positional argument: 'age' I

pySerial works in miniterm but not in my app

2014-10-30 Thread Dario
Python 2.7.6 on Mint, pySerial 2.6 I'm trying to write a console app to control a certain device via a usb com port. In miniterm (-p /dev/ttyUSB0 -e -b 19200), I can communicate correctly with this configuration: --- Settings: /dev/ttyUSB0 19200,8,N,1 --- RTS: inactive DTR: inactive BREAK:

Re: When using a decorator exceptions raised reference the decorator not the function

2014-10-30 Thread Terry Reedy
On 10/30/2014 8:33 AM, Néstor Boscán wrote: I'm using Python 2.7 and I'm creating a class decorator that extract information from exceptions for logging purposes. Everytime an exception is raised from the original function and I extract the origin of the exception with sys.exc_info() I get a re

Re: accents in windows

2014-10-30 Thread Terry Reedy
On 10/30/2014 8:30 AM, C@rlos wrote: thanks U, but the real problem is: i have a path C:\Users\yanet\Desktop\áaaéeeíiiióooúuuñnn this path is correct, áaaéeeíiiióooúuuñnn is the name of a directory but when i try to use os.walk() usin this path, dont work, for os this > path dont exist, i try e

Re: Has color "Green" changed from Python 33 to 34 ?

2014-10-30 Thread Terry Reedy
On 10/30/2014 8:20 AM, Peter Otten wrote: ast wrote: I just updated this morning my Python from a 3.3rc to 3.4 (Windows) and I noticed that the 'Green' color in tkinter GUI is not the same at all. 'Green' in 3.4 is very dark. I had to replace it with 'Lime' to get back a nice 'Green'. More l

Re: What for -- for? (was A bug?)

2014-10-30 Thread Rustom Mody
On Thursday, October 30, 2014 10:53:13 PM UTC+5:30, Joshua Landau wrote: > On 29 October 2014 03:22, Rustom Mody wrote: > > Yesterday I was trying to introduce python to some senior computer > > scientists. > > > > Tried showing a comprehension-based dir-walker vs a for-loop based one: > > > > de

Re: What for -- for? (was A bug?)

2014-10-30 Thread Joshua Landau
On 29 October 2014 03:22, Rustom Mody wrote: > Yesterday I was trying to introduce python to some senior computer scientists. > > Tried showing a comprehension-based dir-walker vs a for-loop based one: > > def dw(p): >if isfile(p): > return [p] >else: > return [p] + [c for f in

Re: Finding way around ABCs (was What for -- for? (was A bug?))

2014-10-30 Thread Rustom Mody
On Thursday, October 30, 2014 10:40:42 PM UTC+5:30, Ian wrote: > On Thu, Oct 30, 2014 at 11:01 AM, Rustom Mody wrote: > > On Wednesday, October 29, 2014 11:49:27 AM UTC+5:30, Zachary Ware wrote: > >> On Wed, Oct 29, 2014 at 1:11 AM, Rustom Mody wrote: > >> > On Wednesday, October 29, 2014 11:10:06

Re: Finding way around ABCs (was What for -- for? (was A bug?))

2014-10-30 Thread Ian Kelly
On Thu, Oct 30, 2014 at 11:09 AM, Ian Kelly wrote: > On Thu, Oct 30, 2014 at 11:01 AM, Rustom Mody wrote: >> On Wednesday, October 29, 2014 11:49:27 AM UTC+5:30, Zachary Ware wrote: >>> On Wed, Oct 29, 2014 at 1:11 AM, Rustom Mody wrote: >>> > On Wednesday, October 29, 2014 11:10:06 AM UTC+5:30,

Re: Finding way around ABCs (was What for -- for? (was A bug?))

2014-10-30 Thread Ian Kelly
On Thu, Oct 30, 2014 at 11:01 AM, Rustom Mody wrote: > On Wednesday, October 29, 2014 11:49:27 AM UTC+5:30, Zachary Ware wrote: >> On Wed, Oct 29, 2014 at 1:11 AM, Rustom Mody wrote: >> > On Wednesday, October 29, 2014 11:10:06 AM UTC+5:30, Zachary Ware wrote: >> >> Of course, that's 3 (progressiv

Finding way around ABCs (was What for -- for? (was A bug?))

2014-10-30 Thread Rustom Mody
On Wednesday, October 29, 2014 11:49:27 AM UTC+5:30, Zachary Ware wrote: > On Wed, Oct 29, 2014 at 1:11 AM, Rustom Mody wrote: > > On Wednesday, October 29, 2014 11:10:06 AM UTC+5:30, Zachary Ware wrote: > >> Of course, that's 3 (progressively shorter) loops to get the names of > >> the ABCs of a c

Re: When using a decorator exceptions raised reference the decorator not the function

2014-10-30 Thread Jean-Michel Pichavant
- Original Message - > From: "Peter Otten" <__pete...@web.de> > To: python-list@python.org > Sent: Thursday, 30 October, 2014 1:45:42 PM > Subject: Re: When using a decorator exceptions raised reference the decorator > not the function > > Néstor Boscán wrote: > > > I'm using Python 2.7

Re: When using a decorator exceptions raised reference the decorator not the function

2014-10-30 Thread Peter Otten
Néstor Boscán wrote: > I'm using Python 2.7 and I'm creating a class decorator that extract > information from exceptions for logging purposes. > > Everytime an exception is raised from the original function and I extract > the origin of the exception with sys.exc_info() I get a reference to the

Re: accents in windows

2014-10-30 Thread Peter Otten
C@rlos wrote: > thanks U, but the real problem is: > > i have a path C:\Users\yanet\Desktop\áaaéeeíiiióooúuuñnn > this path is correct, áaaéeeíiiióooúuuñnn is the name of a directory > but when i try to use os.walk() usin this path, dont work, for os this > path dont exist, i try every things but

When using a decorator exceptions raised reference the decorator not the function

2014-10-30 Thread Néstor Boscán
Hi I'm using Python 2.7 and I'm creating a class decorator that extract information from exceptions for logging purposes. Everytime an exception is raised from the original function and I extract the origin of the exception with sys.exc_info() I get a reference to the line in the decorator where

Re: accents in windows

2014-10-30 Thread C@rlos
thanks U, but the real problem is: i have a path C:\Users\yanet\Desktop\áaaéeeíiiióooúuuñnn this path is correct, áaaéeeíiiióooúuuñnn is the name of a directory but when i try to use os.walk() usin this path, dont work, for os this path dont exist, i try every things but nothing works. some hel

Re: Python Style Question

2014-10-30 Thread MRAB
On 2014-10-30 11:10, Steven D'Aprano wrote: Anton wrote: Let's say I have an incoming list of values *l*. Every element of *l* can be one of the following options: 1) an integer value 2) a string in form of '', e.g. '7' 3) a string with a json serialization of an integer value, e.g. '"7"' 4) so

Re: Has color "Green" changed from Python 33 to 34 ?

2014-10-30 Thread Peter Otten
ast wrote: > I just updated this morning my Python from a 3.3rc to 3.4 > (Windows) and I noticed that the 'Green' color in tkinter > GUI is not the same at all. > > 'Green' in 3.4 is very dark. I had to replace it with 'Lime' to > get back a nice 'Green'. More likely the color is defined by tcl/

Has color "Green" changed from Python 33 to 34 ?

2014-10-30 Thread ast
Hi I just updated this morning my Python from a 3.3rc to 3.4 (Windows) and I noticed that the 'Green' color in tkinter GUI is not the same at all. 'Green' in 3.4 is very dark. I had to replace it with 'Lime' to get back a nice 'Green'. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Style Question

2014-10-30 Thread Steven D'Aprano
Anton wrote: > Let's say I have an incoming list of values *l*. Every element of *l* can > be one of the following options: > 1) an integer value > 2) a string in form of '', e.g. '7' > 3) a string with a json serialization of an integer value, e.g. '"7"' > 4) something else that should be ignor

Re: accents in windows

2014-10-30 Thread Chris Angelico
On Thu, Oct 30, 2014 at 11:03 AM, C@rlos wrote: > i cant print any accent(á é í ó ú) or ñ in console when i use windows OS > with python, the console showme an error or extrangers characters in some > cases, i need help What version of Python? What is your code page set to? Windows and Unicode

testfixtures 4.1.1 Released!

2014-10-30 Thread Chris Withers
Hi All, I'm pleased to announce the release of testfixtures 4.1.1. This is a bugfix release that fixes the following: - Fix bug that prevented logger propagation to be controlled by the log_capture decorator. Thanks to John Kristensen for the fix. It looks like I also forgot to send out th

accents in windows

2014-10-30 Thread C@rlos
i cant print any accent(á é í ó ú) or ñ in console when i use windows OS with python, the console showme an error or extrangers characters in some cases, i need help III Escuela Internacional de Invierno en la UCI del 17 al 28 de febrero del 2014. Ver www.uci.cu -- https://mail.python.org/ma