Re: subprocess problem

2017-02-09 Thread Günther Dietrich
Am 09.02.17 um 18:16 schrieb Andreas Paeffgen: > I guess which does not return an error code. In fact, id does return a return code. Here an example: | honk:~ gdie$ which bash; echo $? | /bin/bash | 0 | honk:~ gdie$ which wzlbrmpf; echo $? | 1 It is 0 on success, 1 for a failure. Exactly the

Re: Mac vs. Linux for Python Development

2014-02-23 Thread Günther Dietrich
twiz twiza...@gmail.com wrote: I've been developing with python recreationally for a while on Ubuntu but will soon be transitioning to full-time python development. I have the option of using a Mac or Ubuntu environment and I'd like to hear any thoughts on the pros and cons of each. I've

Re: Text-to-Sound or Vice Versa (Method NOT the source code)

2013-05-25 Thread Günther Dietrich
Rakshith Nayak rnyk1...@gmail.com wrote: Always wondered how sound is generated from text. Googling couldn't help. Devs having knowledge about this could provide, the information, Links, URLs or anything that could help. Perhaps try 'text to speech' instead of 'text to sound'? Best

Re: I hate you all

2013-04-06 Thread Günther Dietrich
terminato...@gmail.com wrote: [...] The def line has four spaces. The for line then has a hard tab. This is ambiguous. If the hard tab is assumed to have a width of four spaces, then they are at the same indentation level. If it is assumed to have a width of eight spaces, then they are

Re: Help accessing COM .dll from Python

2012-12-01 Thread Günther Dietrich
Steve Simmons square.st...@gmail.com wrote: html head meta http-equiv=content-type content=text/html; charset=ISO-8859-1 /head body text=#00 bgcolor=#FF font size=-1font face=Bitstream Vera SansFirst time post - be gentle wifont size=-1th me :-)br br

Re: try/except KeyError vs if name in ...

2012-10-06 Thread Günther Dietrich
Manuel Pégourié-Gonnard m...@elzevir.fr wrote: Hi, I was looking at the example found here [1] which begins with: [1] http://docs.python.org/py3k/library/imp.html#examples def __import__(name, globals=None, locals=None, fromlist=None): # Fast path: see if the module has already been

Re: Reading properties file in Python, except using ConfigParser()

2012-10-05 Thread Günther Dietrich
justmailha...@gmail.com wrote: How to read properties file in Python? I found ConfigParser() but it has a 'section' limitation, so looking for other alternatives. Have a look at PyYAML. Best regards, Günther -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime issue

2012-09-16 Thread Günther Dietrich
In article cdf072b2-7359-4417-b1e4-d984e4317...@googlegroups.com, Νικόλαος Κούρας nikos.gr...@gmail.com wrote: [...] also it would be nice if datetime.datetime.now(GMT+2) can be used. In news:mailman.774.1347735926.27098.python-l...@python.org, one of the first answers to your question you

Re: Invalid syntax error

2012-03-10 Thread Günther Dietrich
In article 46758542-1bd6-43fe-8e80-bcf14b7d8...@pi6g2000pbc.googlegroups.com, sl33k ahsanbag...@gmail.com wrote: I'm trying project euler problem 3 and I've hit the wall with this error. What could be the problem here? l=[] num=600851475143 i=1 while i=num: ... if num%i==0: ...

Re: mutually exclusive arguments to a constructor

2011-12-30 Thread Günther Dietrich
Adam Funk a24...@ducksburg.com wrote: Suppose I'm creating a class that represents a bearing or azimuth, created either from a string of traditional bearing notation (N24d30mE) or from a number indicating the angle in degrees as usually measured in trigonometry (65.5, measured counter-clockwise

Re: calculate difference between two timestamps [newbie]

2011-12-17 Thread Günther Dietrich
nukeymusic nukeymu...@gmail.com wrote: I'm trying to calculate the difference in seconds between two [...] import datetime date1 = datetime.datetime.strptime(Dec-13-09:47:12, %b-%d-%H:%M:%S) date2 = datetime.datetime.strptime(Dec-13-09:47:39, %b-%d-%H:%M:%S) delta = date2 - date1

Re: Python Windows Extensions for Mac

2011-08-20 Thread Günther Dietrich
In article mailman.252.1313818564.27778.python-l...@python.org, Chris Rebert c...@rebertia.com wrote: On Fri, Aug 19, 2011 at 1:02 PM, johnny.venter johnny.ven...@zoho.com wrote: Hello, I am looking for the Python Windows Extensions to see if they can be installed on a Mac.THanks. Your

Re: PyVISA

2011-04-01 Thread Günther Dietrich
Manatee markrri...@aol.com wrote: I have unpacked the PyVISA files into the Python/lib/site-packages dir and from the IDLE GUI I get and error import visa Traceback (most recent call last): File pyshell#25, line 1, in module import visa ImportError: No module named visa There must be

Re: Inserting class namespace into method scope

2010-11-20 Thread Günther Dietrich
Steven D'Aprano st...@remove-this-cybersource.com.au wrote: I find myself having need of a class where the class scope is included in the scope of methods in the class. A simple example from Python 3.1: x = outside class Magic: x = inside def method(self): return x I would

Re: Light-weight/very-simple version control under Windows using Python?

2010-07-25 Thread Günther Dietrich
pyt...@bdurham.com wrote: I have some very simple use cases[1] for adding some version control capabilities to a product I'm working on. My product uses simple, text (UTF-8) based scripts that are independent of one another. I would like to version control these scripts on behalf of my users. By

Re: Naming Conventions, Where's the Convention Waldo?

2010-07-11 Thread Günther Dietrich
rantingrick rantingr...@gmail.com wrote: Another source of asininity seems to be the naming conventions of the Python language proper! True/False start with an upper case and i applaud this. However str, list, tuple, int, float --need i go on...?-- start with lowercase. Q: Well what the hell is

Re: changing format of time duration.

2010-06-04 Thread Günther Dietrich
Gabriel Genellina gagsl-...@yahoo.com.ar wrote: Try the strptime method with a suitable format, like this (untested): delta = now2-now1 delta.strftime('%H:%M:%S.%f') Throws an exception: |Traceback (most recent call last): | File stdin, line 1, in module |AttributeError: 'datetime.timedelta'

Re: Kindly show me a better way to do it

2010-05-08 Thread Günther Dietrich
Tycho Andersen ty...@tycho.ws wrote: On Sat, May 8, 2010 at 3:41 PM, Oltmans rolf.oltm...@gmail.com wrote: Hi, I've a list that looks like following a = [ [1,2,3,4], [5,6,7,8] ] Currently, I'm iterating through it like for i in [k for k in a]:        for a in i:                print a

Re: formatting a number as percentage

2010-02-23 Thread Günther Dietrich
Hans Mulder han...@xs4all.nl wrote: Did you try this: print('%d%%' % (0.7 * 100)) 70% That method will always round down; TomF's method will round to the nearest whole number: print %d%% % (0.698 * 100) 69% print {0:.0%}.format(.698) 70% It was intended as a hint to this way of

Re: formatting a number as percentage

2010-02-21 Thread Günther Dietrich
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... Did you try this: print('%d%%' % (0.7 * 100)) 70% Best regards, Günther --

Re: create a string of variable lenght

2010-01-31 Thread Günther Dietrich
Tracubik affdfsdfds...@b.com wrote: i want to print on linux console (terminal) a message like this one: error message of variable lenght to print the asterisks line i do this: def StringOfAsterisks(myString):

Re: Default path for files

2010-01-24 Thread Günther Dietrich
Rotwang sg...@hotmail.co.uk wrote: Check out http://docs.python.org/library/os.html and the function chdir it is what you are looking for. Thank you. So would adding import os os.chdir(path) to site.py (or any other module which is automatically imported during initialisation) change the

Re: Python IDE for MacOS-X

2010-01-19 Thread Günther Dietrich
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, I started with 'EasyEclipse for Python', but soon changed to Eclipse with PyDev, MercurialEclipse and AnyEditTools plugins installed

Re: NumPy installation won't import correctly

2009-12-01 Thread Günther Dietrich
Ethos kevint...@gmail.com wrote: I installed NumPy for python 2.6 on my leopard macbook, using the nifty mac installer they now provide. I have the 2.6 official python distro installed on my computer, in addition to the 2.5 that is native on the mac. When I went to test out the installation, with

Re: IDE+hg

2009-11-30 Thread Günther Dietrich
In article qqitt6-ke@spamfence.net, Günther Dietrich gd_use...@spamfence.net wrote: Since no py IDE I found has easy hg access. Obviously, you didn't try Eclipse with PyDev (http://www.pydev.org) and Mercurial Eclipse (http://www.vectrace.com/mercurialeclipse/) plugins. This combination

Re: IDE+hg

2009-11-24 Thread Günther Dietrich
NiklasRTZ nikla...@gmail.com wrote: Since no py IDE I found has easy hg access. Obviously, you didn't try Eclipse with PyDev (http://www.pydev.org) and Mercurial Eclipse (http://www.vectrace.com/mercurialeclipse/) plugins. This combination is also available stuffed into one package as

Re: Formatted input function

2009-09-05 Thread Günther Dietrich
candide cand...@free.invalid wrote: In C, we would manage this with the following statement : fscanf(foo_file, Best score : %d, score); Does Python provide an equivalent ? RTFM! :) In the python 2.5 manual: Chapter 4.2.6 (search pattern 'scanf' on the index tab of python25.chm) There are

Re: Is behavior of += intentional for int?

2009-08-29 Thread Günther Dietrich
zaur szp...@gmail.com wrote: Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type copyright, credits or license() for more information. a=1 x=[a] id(a)==id(x[0]) True a+=1 a 2 x[0] 1 I thought that += should only change the value of

Re: Is behavior of += intentional for int?

2009-08-29 Thread Günther Dietrich
Paul McGuire pt...@austin.rr.com wrote: What exactly are you trying to do? I think, he wants to kind of dereference the list element. So that he can write a += 1 instead of long_name_of_a_list_which_contains_data[mnemonic_pointer_name] += 1 Regards, Günther --

Re: What text editor is everyone using for Python

2009-05-25 Thread Günther Dietrich
LittleGrasshopper seattleha...@yahoo.com wrote: With so many choices, I was wondering what editor is the one you prefer when coding Python, and why. [...] So what do you guys use, and why? Hopefully we can keep this civil. I found 'EasyEclipse for Python' soon after I began using Python. With

Re: problem with money datatype based calculations in python

2009-05-02 Thread Günther Dietrich
Krishnakant krm...@gmail.com wrote: ['money datatype' for database stored values] What ist the real problem? Do you have problems converting results of float calculations to the 'money datatype' before storing them in the database, or do you want to avoid the precision issues which come with

Re: Convert variable directly into a string (no ASCII)

2009-05-02 Thread Günther Dietrich
Justin Rajewski jus...@embeddedmicro.com wrote: I need to print variables out over serial, however I need them to not be in ASCII, ie if the variable is 5 then print 5 not 5. The function that writes to the serial port requires a string and I can send non-variables out with the string /x05 for

Re: ctypes: reference of a struct member?

2009-05-01 Thread Günther Dietrich
ma mabdelka...@gmail.com wrote: If I have this struct in C: struct spam { int ham; char foo; }; if I have this declaration: struct spam s_; If I wanted to pass a reference to a function of s_'s foo character, I can do something like this: somefunc(s_.foo) How do I do the same thing

Re: Please help with problem creating class

2009-04-18 Thread Günther Dietrich
auzarski2...@gmail.com wrote: I am using tab separated data in another file that looks like this... appname1 leadername12005, 02, 022006, 02, 02 appname2 leadername22006, 03, 212007, 06, 28 etc... The error message looks like this back (most recent call last): File