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 res

Re: Mac vs. Linux for Python Development

2014-02-23 Thread Günther Dietrich
twiz 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 been working with

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

2013-05-25 Thread Günther Dietrich
Rakshith Nayak 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 regards, Günther -- h

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

Re: Help accessing COM .dll from Python

2012-12-01 Thread Günther Dietrich
Steve Simmons wrote: > > > > > > >First time post - >be gentle with me :-) > >I am trying to write a Python script to > access a scanning device.  I > have an SDK for the size="-1">scanner but the documentation is a

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

2012-10-06 Thread Günther Dietrich
Manuel Pégourié-Gonnard 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 imported. >t

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 , Νικόλαος Κούρας wrote: [...] >also it would be nice if datetime.datetime.now(GMT+2) can be used. In , one of the first answers to your question you were pointed to pytz. This module does exactly what you ask for: >>> imp

Re: Invalid syntax error

2012-03-10 Thread Günther Dietrich
In article <46758542-1bd6-43fe-8e80-bcf14b7d8...@pi6g2000pbc.googlegroups.com>, sl33k 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 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 >from the x-axis

Re: calculate difference between two timestamps [newbie]

2011-12-17 Thread Günther Dietrich
nukeymusic 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 >>> delta_

Re: Python Windows Extensions for Mac

2011-08-20 Thread Günther Dietrich
In article , Chris Rebert wrote: >On Fri, Aug 19, 2011 at 1:02 PM, johnny.venter wrote: >> >> Hello, I am looking for the Python Windows Extensions to see if they can be >> installed on a Mac.THanks. > >Your request is nonsensical. That's not completely true. >pywin32 wraps the Windows API

Re: PyVISA

2011-04-01 Thread Günther Dietrich
Manatee 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 "", line 1, in >import visa >ImportError: No module named visa > > > >There must be more to just putting

Re: Inserting class namespace into method scope

2010-11-20 Thread Günther Dietrich
Steven D'Aprano 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 like Magic().method() t

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

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

2010-07-11 Thread Günther Dietrich
rantingrick 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 your problem Ric

Re: changing format of time duration.

2010-06-04 Thread Günther Dietrich
Gabriel Genellina 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 "", line 1, in |AttributeError: 'datetime.timedelta' object has no attribute 'strft

Re: Kindly show me a better way to do it

2010-05-08 Thread Günther Dietrich
Tycho Andersen wrote: >On Sat, May 8, 2010 at 3:41 PM, Oltmans 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 >> >> but I was wond

Re: formatting a number as percentage

2010-02-23 Thread Günther Dietrich
Hans Mulder 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 w

Re: formatting a number as percentage

2010-02-21 Thread Günther Dietrich
vsoler 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 -- http://mail.python.org/mailman/listinfo/python-list

Re: create a string of variable lenght

2010-01-31 Thread Günther Dietrich
Tracubik 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): >asterisksString = "*" >

Re: Default path for files

2010-01-24 Thread Günther Dietrich
Rotwang 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() > >to site.py (or any other module which is automatically imported during >initialisation) change the default locati

Re: Python IDE for MacOS-X

2010-01-19 Thread Günther Dietrich
Jean Guillaume Pyraksos 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 manually. I can

Re: NumPy installation won't import correctly

2009-12-01 Thread Günther Dietrich
Ethos 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 2.6, it >gave m

Re: IDE+hg

2009-11-30 Thread Günther Dietrich
In article , "Günther Dietrich" 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. >Thi

Re: IDE+hg

2009-11-24 Thread Günther Dietrich
NiklasRTZ wrote: >Since no py IDE I found has easy hg access. Obviously, you didn't try Eclipse with PyDev () and Mercurial Eclipse () plugins. This combination is also available stuffed into one package as 'EasyEclipse for Pyth

Re: Formatted input function

2009-09-05 Thread Günther Dietrich
candide 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 some scanf-pat

Re: Is behavior of += intentional for int?

2009-08-29 Thread Günther Dietrich
Paul McGuire 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 -- http://mail.python.org/mailman/listin

Re: Is behavior of += intentional for int?

2009-08-29 Thread Günther Dietrich
zaur 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

Re: What text editor is everyone using for Python

2009-05-25 Thread Günther Dietrich
LittleGrasshopper 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 PyDev, it even cont

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

2009-05-02 Thread Günther Dietrich
Justin Rajewski 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 5. See module st

Re: problem with money datatype based calculations in python

2009-05-02 Thread Günther Dietrich
Krishnakant 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 the conversion od

Re: ctypes: reference of a struct member?

2009-05-01 Thread Günther Dietrich
ma 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 in ct

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 las