Re: Python usage numbers

2012-02-11 Thread Andrew Berg
On 2/11/2012 3:02 PM, Eric Snow wrote: > I'm thinking about this partly because of the discussion on > python-ideas about the perceived challenges of Unicode in Python 3. > For instance, if frameworks (like django and numpy) could completely > hide the arguable challenges of Unicode in Python 3--a

Re: Python usage numbers

2012-02-11 Thread Andrew Berg
On 2/12/2012 12:10 AM, Steven D'Aprano wrote: > It's not just UTF8 either, but nearly all encodings. You can't even > expect to avoid problems if you stick to nothing but Windows, because > Windows' default encoding is localised: a file generated in (say) Israel > or Japan or Germany will use a

Re: Python usage numbers

2012-02-12 Thread Andrew Berg
On 2/12/2012 3:12 AM, Steven D'Aprano wrote: > NTFS by default uses the UTF-16 encoding, which means the actual bytes > written to disk are \x1d\x040\x04\xe5\x042\x04 (possibly with a leading > byte-order mark \xff\xfe). That's what I meant. Those bytes will be interpreted consistently across all

Re: Python usage numbers

2012-02-13 Thread Andrew Berg
On 2/12/2012 10:19 PM, Ben Finney wrote: > If it helps, ASCII art *is* UTF-8 art. So it will be the same in UTF-8. As will non-ASCII text art:   /l、 ゙(゚、 。 7  l、゙ ~ヽ   じしf_, )ノ -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: Change os.makedirs to handle existing directory

2012-02-13 Thread Andrew Berg
On 2/13/2012 4:59 PM, Wanderer wrote: > I think wanting to create a directory if one doesn't exist or do > nothing if it does exist and just use the existing directory is a > fairly normal programming need. Apparently this is somewhat > complicated in Python. There are new exceptions in 3.3, one o

Re: Interactive keyword help

2012-02-15 Thread Andrew Berg
On 2/15/2012 10:04 AM, Mark Lawrence wrote: > I didn't realise that this was available until today. It doesn't appear > to be prominent in the official docs or have I missed something? > Certainly I'd have thought a couple of sentences here > http://www.python.org/about/help/ would be justified

Re: Script randomly exits for seemingly no reason with strange traceback

2012-02-15 Thread Andrew Berg
On 2/15/2012 3:28 PM, John Nagle wrote: > Are you doing a conditional import, one that takes place after load > time? If you do an import within a function or class, it is executed > when the code around it executes. If you import a file with a > syntax error during execution, you could get the e

Re: Is this the right list?

2012-02-16 Thread Andrew Berg
On 2/16/2012 9:33 AM, Chris Angelico wrote: > On Fri, Feb 17, 2012 at 1:43 AM, Rick Johnson > wrote: >> On Feb 15, 4:04 pm, Terry Reedy wrote: >>> On 2/15/2012 4:51 PM, Alan McKay wrote: >>> >>> > Is this the right list? >> >> This is neither the "right" or "left" list, however, it may be either

Re: [OT]: Smartphones and Python?

2012-02-17 Thread Andrew Berg
On 2/17/2012 10:51 PM, 8 Dihedral wrote: > 在 2012年2月18日星期六UTC+8上午9时51分13秒,Michael Torrie写道: >> On 02/16/2012 10:25 PM, 8 Dihedral wrote: >> > Android is a customized linux OS used in mobile phones. I don't think >> > any linux systm has to be locked by JAVA or any JVM to run >> > applicatio

Re: Please verify!!

2012-02-23 Thread Andrew Berg
On 2/23/2012 4:43 PM, Dave Angel wrote: > First thing I'd do is to disable tab logic in the editor. When you > press the tab key, there's no excuse for an editor to actually put a tab > in the file. It should adjust the column by adding the appropriate > number of spaces. Unless, of course, yo

Re: Please verify!!

2012-02-23 Thread Andrew Berg
On 2/24/2012 1:11 AM, Manish Sharma wrote: > Still my question is what if I open the file and dont make any changes > to it and close it again? Can it be possible just by doing these steps > add indentation to lines? I am not changing the file prefrences to open > it always with notepad++. Opening

Re: Please verify!!

2012-02-24 Thread Andrew Berg
On 2/24/2012 2:32 AM, Ben Finney wrote: > Are you referring to novice programmers – who, by any reasonable > definition of “novice”, don't have an opinion on the tabs-versus-spaces > indentation debate? > > Or are you talking about people who are experienced enough to have an > opinion and expect

Re: Please verify!!

2012-02-24 Thread Andrew Berg
On 2/24/2012 5:21 AM, Duncan Booth wrote: > The original question was about Notepad++ which is nothing at all like > Notepad. And I did give the OP an answer about Notepad++ specifically in another message. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/

Re: Please verify!!

2012-02-24 Thread Andrew Berg
On 2/24/2012 6:20 AM, Steven D'Aprano wrote: > Opinions need to be informed to be better than useless. By definition > newbies don't have the experience to have informed opinions. I thought I had implied that I meant informed opinions, but apparently not. > There are many times that we can't affo

Re: Pickle performing class instantiation ??

2012-02-28 Thread Andrew Berg
On 2/28/2012 9:54 AM, Smiley 4321 wrote: > NameError: name 'self' is not defined self is meaningless outside a class definition. You should refactor your dump, load and print code as methods inside the class definition, create an instance and call the methods on that instance. -- CPython 3.2.2 |

Re: Invalid syntax error

2012-03-10 Thread Andrew Berg
On 3/10/2012 6:34 AM, 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: > ... l.append(i) > ... i+=1 > ... print max(l) > File "

Re: [RELEASED] Python 3.3.0 alpha 2

2012-04-01 Thread Andrew Berg
> To download Python 3.3.0 visit: > > http://www.python.org/download/releases/3.3.0/ The Windows links point to 3.3a1 installers, even though the links say 3.3a2. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: What is the best way to freeze a Python 3 app (Windows)?

2012-04-03 Thread Andrew Berg
cx_Freeze is the only program that can freeze py3k code that I know of. I didn't have any major issues with it, but I've only played with it. In any case, if you're going to roll your own, I'd be happy to help test it. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailma

Re: Distribute app without source?

2012-04-07 Thread Andrew Berg
On 4/7/2012 8:07 AM, Bill Felton wrote: > We are using Python 3.2 and tkinter. It appears, and limited testing bears > out, that py2app, and presumably py2exe, are not options given lack of 3.x > support. cx_Freeze supports Python 3.2. It works fine for my purposes, but I have not done any serio

Re: Python Script Works Locally But Not Remotely with SSH

2012-04-07 Thread Andrew Berg
On 4/7/2012 11:59 AM, goldtech wrote: I thought if I SSH > even from a Linux to a Windows machine whatever I say on the SSH > client command line would be the same as me doing a command on the > "DOS" command-line in Windows. I incorrectly thought SSH is just a > tunnel for text... It gives you wh

Re: f python?

2012-04-09 Thread Andrew Berg
On 4/9/2012 1:52 AM, Chris Angelico wrote: > I think this will be a real winner, and you > should team up with Ranting Rick to produce a new operating system and > Python with this new specification and RULE THE WORLD! But only after going back to the cage to plan for tomorrow night. -- CPython 3

Re: Python randomly exits with Linux OS error -9 or -15

2012-04-09 Thread Andrew Berg
On 4/9/2012 5:01 AM, Janis wrote: > I have this problem with my script exiting randomly with Linux OS > status code -9 (most often) or -15 (also sometimes, but much more > rarely). As far as I understand -9 corresponds to Bad file descriptor > and -15 Block device required. > > 1) Is there a way h

Re: Newbie python questions...

2012-04-14 Thread Andrew Berg
On 4/14/2012 1:25 PM, vmars316 wrote: > I installed portablePython(pP) here: > C:\Users\vmars\Python3 > ?Does that look ok? I would suggest including the minor version number (i.e. Python32 instead of Python3) because not all 3.x code is compatible with all versions of Python 3.x - all code that w

Re: Python Gotcha's?

2012-04-15 Thread Andrew Berg
On 4/15/2012 3:01 PM, Bryan wrote: > I'd like to encourage my users to check out > Python 3, but installing it on Windows will take over the '.py' > extension and break stuff that currently works. Have you tried telling your users to tell the installer not to do that? IIRC, it's a simple checkbox o

Re: How to execute/run a *.py file, win7, py3.2..?

2012-04-15 Thread Andrew Berg
On 4/15/2012 11:30 PM, vmars316 wrote: > Isn't there a way just to doubleClick on myProg.py, to get it into the > interpret/RUN? Use the standard installer from python.org if you want to do things with the registry. The standard installer sets up the registry for you so that the interpreter will be

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Andrew Berg
On 4/26/2012 6:37 AM, Kiuhnm wrote: > Python has been "forked" into 2.x and 3.x because some breaking changes > ought to be made to the language in order to improve it and clean it up. That's not really a good way to put it. 2.6 and 2.7 will get security fixes, but there won't be a 2.8 unless some

Re: Upgrading from 2.7 to 3.x

2012-04-26 Thread Andrew Berg
On 4/26/2012 8:02 AM, deuteros wrote: > So how do I tell my IDE (Eclipse with PyDev) which version of Python I > want to use? When you start a new PyDev project, it will ask. -- CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790 -- http://mail.python.org/mailman/listinfo/python-list

Re: Learn Technical Writing from Unix Man in 10 Days

2012-04-28 Thread Andrew Berg
On 4/28/2012 6:45 PM, Temia Eszteri wrote: > Professional? He's boring! I agree. Ranting Rick is much more entertaining (usually). -- CPython 3.2.3/3.3.0a2 | Windows NT 6.1.7601.17790 -- http://mail.python.org/mailman/listinfo/python-list

Re: try/except in a loop

2012-05-02 Thread Andrew Berg
Why wouldn't a for loop work? If something works, you can break out, otherwise continue. working_obj = None for obj in iterable: try: obj.do_something() working_obj = obj break except: continue -- CPython 3.3.0a3 | W

Re: try/except in a loop

2012-05-02 Thread Andrew Berg
Forgot to add that all this is covered in the tutorial in the official docs: http://docs.python.org/tutorial/controlflow.html#for-statements -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790 -- http://mail.python.org/mailman/listinfo/python-list

Re: When convert two sets with the same elements to lists, are the lists always going to be the same?

2012-05-03 Thread Andrew Berg
On 5/3/2012 7:36 PM, Peng Yu wrote: > When convert two sets with the same elements to two lists, are the > lists always going to be the same (i.e., the elements in each list are > ordered the same)? Is it documented anywhere? Sets are by definition unordered, so depending on their order would not b

Re: Pydev configuration

2012-05-10 Thread Andrew Berg
On 5/9/2012 4:25 PM, Alan Ristow wrote: > Select the code block you want to indent and hit Tab. To do the reverse, > hit Shift-Tab. You can also select a code block and choose "Shift Right" or "Shift Left" from the context menu. -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790 -- http://mail.pyth

Re: Python and Tkinter by John E Grayson

2012-05-17 Thread Andrew Berg
On 5/17/2012 6:48 AM, Mark R Rivet wrote: > I am in the process of learning python, and want to learn tkinter for > GUI stuff. Is tkinter what people are using for GUI? tkinter is one of several GUI toolkits that can be used with Python. IIRC, most people use PyGTK or PyQt for serious projects. ht

Re: Install python 2.6 and python 2.7 on Windows

2012-05-22 Thread Andrew Berg
On 5/22/2012 6:44 PM, Gelonida N wrote: > I'd like to install python 2.6 and 2.7 on Windows? > > > In fact I have already 2.6 installed and would like to additionally > install 2.7 > > > > When clicking on .py file I'd like to execute it with python 2.6 There is an checkbox for an option to

Re: Install python 2.6 and python 2.7 on Windows

2012-05-23 Thread Andrew Berg
On 5/23/2012 3:25 PM, Gelonida N wrote: > So I just install 2.7 and uncheck this box and I'll keep 2.6 right? Different versions are installed in different locations by default, and if you uncheck that box, the installer will leave file associations alone. -- CPython 3.3.0a3 | Windows NT 6.1.7601

Re: Scoping Issues

2012-05-24 Thread Andrew Berg
On 5/24/2012 8:59 PM, Dave Angel wrote: > so I fixed that, and got > inconsistent use of tabs and spaces in indentation > > because you mistakenly used tabs for indentation. Not to start another tabs-vs.-spaces discussion, but tabs are perfectly legal indentation in Python. That exception is

Re: python3 raw strings and \u escapes

2012-05-30 Thread Andrew Berg
On 5/30/2012 1:52 AM, ru...@yahoo.com wrote: > Was there a reason for dropping the lexical processing of > \u escapes in strings in python3 (other than to add another > annoyance in a long list of python3 annoyances?) To me, this would be a Python 2 annoyance since I would expect r'\u3000' to be li

Re: ./configure

2012-06-03 Thread Andrew Berg
On 6/3/2012 5:01 PM, Janet Heath wrote: > Thanks Alain. I should have a compiler on my Mac OS X Lion. I am thinking > that it isn't set in my $PATH variable. I don't know where the $PATH is set > at. I will check to see if their is a binary. There are always Windows and OS X binary installers

Re: English version for Mémento Python 3 (draft, readers needed)

2012-06-06 Thread Andrew Berg
On 6/6/2012 1:45 PM, MRAB wrote: > On 06/06/2012 18:23, Jugurtha Hadjar wrote: > [snip] >> "range returns a « generator », convert it to list to see.." --> >> "converts" instead of "convert". >> > No, "convert" is correct here; it's the imperative, i.e. "convert it to > a list if you want to see.

Re: PyDoc - Python Documentation Plugin for Eclipse

2012-06-10 Thread Andrew Berg
On 6/10/2012 4:22 AM, Alexey Gaidamaka wrote: > Practically the plugin is a simple html archive from python > documentation website running > inside Eclipse so you can call it using Eclipse help system. > As for now it is pretty large (~7 mb), but i'm planning to optimize it > in near future. Rath

Re: Internationalized domain names not working with URLopen

2012-06-12 Thread Andrew Berg
On 6/13/2012 1:17 AM, John Nagle wrote: > What does "urllib2" want? Percent escapes? Punycode? Looks like Punycode is the correct answer: https://en.wikipedia.org/wiki/Internationalized_domain_name#ToASCII_and_ToUnicode I haven't tried it, though. -- CPython 3.3.0a3 | Windows NT 6.1.7601.17790

Re: is the same betweent python3 and python3.2?

2012-06-16 Thread Andrew Berg
On 6/15/2012 11:31 PM, contro opinion wrote: > is the /usr/lib/python-3.2.3/bin/python3 same as > /usr/lib/python-3.2.3/bin/python3.2? It should be. IIRC, ls -l will tell you if something is a link. You could also run python3 and it will tell you the version. -- CPython 3.3.0a4 | Windows NT 6.1.

Re: Is that safe to use ramdom.random() for key to encrypt?

2012-06-17 Thread Andrew Berg
On 6/17/2012 7:07 PM, Jon Clements wrote: > I'm reminded of: > > http://xkcd.com/936/ > http://xkcd.com/792/ > > There's also one where it's pointed out it's easier to brute force a > person who has the code, than brute force the computer. [but can't find > that one at the moment] http://xkcd.

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
Perhaps this will clear things up: Python 3.3.0a4 (v3.3.0a4:7c51388a3aa7, May 31 2012, 20:17:41) [MSC v.1600 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ua = u'a' >>> literal_ua = "u'a'" >>> ua == literal_ua False >>> input_ua = input() u'a'

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 11:32 AM, Jussi Piitulainen wrote: > jmfauth writes: > >> Thinks are very clear to me. I wrote enough interactive >> interpreters with all available toolkits for Windows > r = input() > u'a > Traceback (most recent call last): > File "", line 1, in > SyntaxError: u'a > > Er,

Re: Py3.3 unicode literal and input()

2012-06-18 Thread Andrew Berg
On 6/18/2012 12:03 PM, Dave Angel wrote: > And you're missing the context. jmfauth thinks we should re-introduce > the input/raw-input distinction so he could parse literal strings. So > Jussi demonstrated that the 2.x input did NOT satisfy fmfauth's dreams. You're right. I missed that part of jm

Checking compatibility of a script across Python versions automatically

2012-06-18 Thread Andrew Berg
Are there any tools out there that will parse a script and tell me if it is compatible with an arbitrary version of Python and highlight any incompatibilities? I need to check a few of my scripts that target 3.2 to see if I can make them compatible with 3.0 and 3.1 if they aren't already. I found p

Re: Newby Python help needed with functions

2011-06-03 Thread Andrew Berg
On 2011.06.03 09:42 AM, Cathy James wrote: > I need a jolt here with my python excercise, please somebody!! How can > I make my functions work correctly? I tried below but I get the > following error: > > if f_dict[capitalize]: > > KeyError: > ... > > def capitalize (s): > """capitalize accep

Re: Python 2.6 OR 3.2

2011-06-09 Thread Andrew Berg
On 2011.06.09 12:18 PM, hisan wrote: > Hi All, > > Please let me know which one is GOOD whether Python 2.6 OR 3.2. > Please let me know the difference between them. > Please give some refernce site or books to know the difference I'm just a beginner, but AFAICT, there are three reasons to learn Pyt

Re: PyQt

2011-06-10 Thread Andrew Berg
On 2011.06.10 08:09 AM, KK wrote: > I have python 3.2 installed m not able to install PyQt. > i have downloaded and configured sip but how to build it??? The pages are misleading. You only need the SIP source if you want to build everything from source. Since you don't seem to be familiar with

Re: Square bracket and dot notations?

2011-06-11 Thread Andrew Berg
On 2011.06.11 04:41 AM, Asen Bozhilov wrote: > Hi all, > I am beginner in Python. What is interesting for me is that Python > interpreter treats in different way dot and square bracket notations. > I am coming from JavaScript where both notations lead prototype chain > lookup. > > In Python it seem

__dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
I'm pretty happy that I can copy variables and their value from one object's namespace to another object's namespace with the same variable names automatically: class simpleObject(): pass a = simpleObject() b = simpleObject() a.val1 = 1 a.val2 = 2 b.__dict__.update(a.__dict__) a.val1 = 'a'

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 09:12 PM, Terry Reedy wrote: > On 6/11/2011 9:32 PM, Andrew Berg wrote: > > I'm pretty happy that I can copy variables and their value from one > > You are copying names and their associations, but not the objects or > thier values. Associations? The upd

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 09:13 PM, Steven D'Aprano wrote: > So never update from a random object you don't know well. Of course. In the project I'm working on, this will be used in the __init__() method of a class that accepts a pair of dictionaries or possibly **kwargs (for flexibility and to avoid the very

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 10:08 PM, Ian Kelly wrote: > For immutable objects such as > ints, this doesn't matter. For mutable objects such as lists, it can: Well, that's confusing. How would I make actual copies? -- http://mail.python.org/mailman/listinfo/python-list

Re: __dict__ is neato torpedo!

2011-06-11 Thread Andrew Berg
On 2011.06.11 10:40 PM, Ben Finney wrote: > It's exactly the same as with an ordinary assignment (‘a = b’) in > Python. Fair enough. > > How would I make actual copies? > At what level? Level? I just want to be able to create an object b with values from dictionary a, and not have changes to a refl

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Andrew Berg
On 2011.06.13 08:58 PM, Chris Angelico wrote: > That's one of the reasons I like my laptop keyboard so much. I find that the terribly tiny keys on a laptop keyboard make them very evil. I don't see how anyone could type fast on one of them without making tons of errors. I constantly have to fix typ

Re: Keyboard Layout: Dvorak vs Colemak: is it Worthwhile to Improve the Dvorak Layout?

2011-06-14 Thread Andrew Berg
On 2011.06.14 07:18 PM, Chris Angelico wrote: > There are many different designs of laptop keyboard. Tiny netbooks > seem to have the very worst, leaving it nearly impossible to get any > decent work done (there may be exceptions to that, but I've seen a lot > of bad netbook keyboards). My current

Re: Function within class and in modules

2011-06-16 Thread Andrew Berg
On 2011.06.15 08:57 AM, Zach Dziura wrote: > Just repeat this to yourself: Python ISN'T Java. class MainClass: def public static void main(*args): print('Am I doin' it right?') :P Or something like that. I've forgotten almost everything I learned about Java. -- http://mail.python.org

Re: How do you copy files from one location to another?

2011-06-16 Thread Andrew Berg
On 2011.06.17 12:06 AM, John Salerno wrote: > "On Windows, if dst already exists, OSError will be raised even if it > is a file.." If you try to create a file or directory that already exists on Windows, you'll get a WindowsError with error code 183: >>> os.mkdir('C:\\common\\games') Traceback (mos

Re: what happens inside?

2011-06-22 Thread Andrew Berg
On 2011.06.22 10:45 AM, Chetan Harjani wrote: > why tuples are immutable whereas list are mutable? Tuples are more efficient and more appropriate for a list of items that doesn't need to change. > why when we do x=y where y is a list and then change a element in x, y > changes too( but the same is

Re: compile 32bit application in python for use on 64bit win machine

2011-06-23 Thread Andrew Berg
On 2011.06.23 06:24 PM, miamia wrote: > Hello, > I am using 32bit win xp pro and compiling my python scripts as exe > with py2exe. Everything works ok on 32bit windows platforms. But how > can I compile my program for use on 64bit Windows? > > On 64bit windows this error occures in event log: > Act

Re: how to write to registry without admin rights on win vista/7

2011-06-24 Thread Andrew Berg
On 2011.06.24 03:48 AM, Duncan Booth wrote: > http://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script Heh. On Windows 7, using 'runas' for the operation in os.startfile() gives me a normal UAC prompt. Is there any way to ask for elevation from a subprocess.Popen

Re: how to write to registry without admin rights on win vista/7

2011-06-24 Thread Andrew Berg
On 2011.06.24 03:48 AM, Duncan Booth wrote: > http://stackoverflow.com/questions/130763/request-uac-elevation-from-within-a-python-script Heh. On Windows 7, using 'runas' for the operation in os.startfile() gives me a normal UAC prompt. Is there any way to ask for elevation from a subprocess.Popen

Re: Python basic program problem

2011-06-27 Thread Andrew Berg
On 2011.06.27 02:05 AM, Amaninder Singh wrote: > Hi, > I am fairly new to python, I am trying to write simple code and It is > giving me syntax error. I am reading a book and following the > directions as it says in the book but I am not sure why it is not > working. Looks like the book you're read

Re: windows 7 create directory with read write execute permission for everybody

2011-06-27 Thread Andrew Berg
On 2011.06.26 03:57 PM, Gelonida wrote: > The reason I am asking is, that I'd like to create a directory structure > where multiple users should be allowed to read / write / create files > and directories. This may not require pywin32 - by default there's a public directory at os.environ['public'

Trying to chain processes together on a pipeline

2011-06-27 Thread Andrew Berg
I'm working on an audio/video converter script (moving from bash to Python for some extra functionality), and part of it is chaining the audio decoder (FFmpeg) either into SoX to change the volume and then to the Nero AAC encoder or directly into the Nero encoder. This is the chunk of code from my

Re: Trying to chain processes together on a pipeline

2011-06-27 Thread Andrew Berg
On 2011.06.28 01:32 AM, Peter Otten wrote: > >>> subprocess.call(["ls"], stdout=open(os.devnull, "w")) > 0 D'oh! Not sure why I was thinking os.devnull was a file object. :-[ > Start with factoring out common code into a good old function. For some reason I was thinking I would have problems doing

Re: Trying to chain processes together on a pipeline

2011-06-28 Thread Andrew Berg
On 2011.06.28 02:44 AM, Thomas Rachel wrote: > The way you work with the exception is not the very best - instead of > parsing the stringified exception, you better would trigger on > exc.winerror (it is an integer with the error number). > > Or, even better, just pas the error information contai

Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Andrew Berg
I didn't get at least two messages from the "call a function every 10 seconds thread", and possibly some other messages, and I access the group via the mailing list. I use the latest stable Thunderbird, if that matters. I've only noticed this recently, and I'm still getting other messages. In fact,

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Andrew Berg
On 2011.06.29 03:53 PM, Noah Hall wrote: > I think the more likely answer is that it was sent without being also > sent to python-list. Possible, but they were two messages from two different people and happened within a few hours of each other, so it could be that the two messages didn't go throug

Re: Is the Usenet to mailing list gateway borked?

2011-06-29 Thread Andrew Berg
I forgot to mention I don't have Usenet access, and Google Groups' archives don't have messages from the last couple of days, so I can't check the Usenet side. -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to chain processes together on a pipeline

2011-06-30 Thread Andrew Berg
Okay, so I've refactored those except WindowsError blocks into calls to a function and fixed the os.devnull bug, but I still can't get the triple chain working. I added calls to ffmpeg_proc.stdout.close() and sox_proc.stdout.close(), but I really am not sure where to put them. The following code wo

Re: Trying to chain processes together on a pipeline

2011-07-01 Thread Andrew Berg
On 2011.07.01 02:26 AM, Peter Otten wrote: > I can't reproduce your setup, but I'd try using communicate() instead of > wait() and close(). I don't really know what communicate() does. The docs don't give much info or any examples (that explain communicate() anyway), and don't say when communicate

Re: Trying to chain processes together on a pipeline

2011-07-02 Thread Andrew Berg
This code is working: > try: > ffmpeg_proc = subprocess.Popen(queue[position].ffmpeg_cmd, > stdout=subprocess.PIPE, stderr=open(os.devnull, 'w')) > except WindowsError as exc: > log_windows_error(exc, queue[position].ffmpeg_cmd, 'critical') > break > if queue[pos

Re: The end to all language wars and the great unity API to come!

2011-07-05 Thread Andrew Berg
On 2011.07.05 01:14 PM, sal migondis wrote: > How could a belief be wrong? Beliefs aren't subjective. One's taste in music, for example, is largely subjective and can't be right or wrong, but a belief (which has to do with facts) certainly can be. > > > What do you think will be the eventual outco

Re: embedding: how do I redirect print output?

2011-07-05 Thread Andrew Berg
On 2011.07.05 10:20 AM, Chris Angelico wrote: > You, sir, have a warped and twisted mind. > > And I love it!! > > Now to secretly put code into some module somewhere and wait for > people to start tearing their hair out wait, did I say that out > loud? from pytroll import print -- http://mail.

Microsoft GUIs (was: The end to all language wars and the great unity API to come!) (OT)

2011-07-05 Thread Andrew Berg
On 2011.07.05 09:31 PM, Chris Angelico wrote: > I've said for a while that Microsoft could do far worse than to turn > Windows into a GUI that sits on top of a Unix-derived kernel. They > won't do it, though, because it would be tantamount to admitting both > that Unix is superior to Windows, AND t

Re: Microsoft GUIs

2011-07-05 Thread Andrew Berg
On 2011.07.05 11:25 PM, Chris Angelico wrote: > Suppose I gave you a computer that had GNOME ported to Windows, and > used the purplish palette that Ubuntu 10.10 uses, and had a Windows > port of bash as its most convenient terminal. Members of this list > will doubtless have no problem duck-typing

Re: Microsoft GUIs

2011-07-05 Thread Andrew Berg
On 2011.07.06 12:03 AM, Dan Stromberg wrote: > I disagree. The stuff endusers tend to use is polished to some > extent, but the backend is verging on hideous. If a developer > complains about the ugly internal structure "yeah, but you say that > just because you're a computer person / geek." Admi

Re: The end to all language wars and the great unity API to come!

2011-07-05 Thread Andrew Berg
On 2011.07.06 12:26 AM, Dennis Lee Bieber wrote: > On Tue, 05 Jul 2011 16:01:57 -0500, Andrew Berg > declaimed the following in > gmane.comp.python.general: > > > On 2011.07.05 01:14 PM, sal migondis wrote: > > > How could a belief be wrong? > > Beliefs aren&#x

Re: Implicit initialization is EVIL!

2011-07-06 Thread Andrew Berg
On 2011.07.06 11:11 AM, Steven D'Aprano wrote: > The Dead Window Sketch > == As much as I hate it when people feed trolls, that was pretty funny. -- http://mail.python.org/mailman/listinfo/python-list

Re: Implicit initialization is EVIL!

2011-07-06 Thread Andrew Berg
On 2011.07.06 01:19 PM, rantingrick wrote: > ## > The Roman Stawman Sketch > ## Nice try, but you have to use a Monty Python sketch (and you have to spell correctly :-P ). -- http://mail.python.org/mailman/listinfo/python-list

Re: Does hashlib support a file mode?

2011-07-06 Thread Andrew Berg
On 2011.07.06 12:38 PM, Phlip wrote: > Python sucks. m = md5() looks like an initial assignment, not a > special magic storage mode. Principle of least surprise fail, and > principle of most helpful default behavior fail. func() = whatever the function returns func = the function object itself (in

Re: Does hashlib support a file mode?

2011-07-06 Thread Andrew Berg
On 2011.07.06 02:07 PM, Phlip wrote: > If I call m = md5() twice, I expect two objects. You get two objects because you make the function run again. Of course, the first one is garbage collected if it doesn't have another reference. >>> m1 = hashlib.md5() >>> m2 = hashlib.md5() >>> m1 is m2 False

Re: Does hashlib support a file mode?

2011-07-07 Thread Andrew Berg
On 2011.07.06 06:16 PM, Steven D'Aprano wrote: > Phlip wrote: > > > Note the fix also avoids comparing to None, which, as usual, is also > > icky and less typesafe! > > "Typesafe"? Are you trying to make a joke? Maybe he has a duck phobia. Maybe he denies the existence of ducks. Maybe he doesn't li

Re: Does hashlib support a file mode?

2011-07-07 Thread Andrew Berg
On 2011.07.07 08:11 AM, Phlip wrote: > No, I was pointing out that passing a type is more ... typesafe. None is a type. >>> None.__class__ -- http://mail.python.org/mailman/listinfo/python-list

Re: Does hashlib support a file mode?

2011-07-07 Thread Andrew Berg
On 2011.07.07 08:39 AM, Phlip wrote: > On Jul 7, 6:24 am, Andrew Berg wrote: > > On 2011.07.07 08:11 AM, Phlip wrote:> No, I was pointing out that passing a > > type is more ... typesafe. > > > > None is a type. > > I never said it wasn't. You

Re: Question- Getting Windows 64bits information Python 32bits

2011-07-07 Thread Andrew Berg
On 2011.07.07 10:21 AM, António Rocha wrote: > I'm running Python (32b) in Windows7 (at 64bits) and I would like to > know how can I check if my machine is a 32b or 64b in Python. Is it > possible? I saw a few examples (like platform) but they only provide > information about Python not the machine

Re: Programming tips :-)

2011-07-07 Thread Andrew Berg
On 2011.07.07 12:22 PM, Martin Schöön wrote: > I just found the following url in my archives at work and > thought you might enjoy it: > http://thc.org/root/phun/unmaintain.html That's awesome. > If a maintenance programmer can't quote entire Monty Python movies > from memory, he or she has *no* b

Re: Does hashlib support a file mode?

2011-07-07 Thread Andrew Berg
On 2011.07.07 08:46 PM, Steven D'Aprano wrote: > None is not a type, it is an instance. > > >>> isinstance(None, type) # is None a type? > False > >>> isinstance(None, type(None)) # is None an instance of None's type? > True > > So None is not itself a type, although it *has* a type: > > >>> type

Re: Implicit initialization is EVIL!

2011-07-08 Thread Andrew Berg
On 2011.07.07 12:29 PM, rantingrick wrote: > So you prefer to close a gazillion windows one by one? If so, why not > just code the GUI correctly from the start; by creating separate > transactions? Thereby reducing the number of windows a user must > juggle? FYI: You know the user complexity of a G

String concatenation vs. string formatting

2011-07-08 Thread Andrew Berg
Is it bad practice to use this > logger.error(self.preset_file + ' could not be stored - ' + > sys.exc_info()[1]) Instead of this? > logger.error('{file} could not be stored - > {error}'.format(file=self.preset_file, error=sys.exc_info()[1])) Other than the case where a variable isn't a string (f

Re: String concatenation vs. string formatting

2011-07-08 Thread Andrew Berg
On 2011.07.08 05:59 PM, Ben Finney wrote: > With the caveat that the formatting of that line should be using PEP 8 > indentation for clarity: PEP 8 isn't bad, but I don't agree with everything in it. Certain lines look good in chunks, some don't, at least to me. It's quite likely I'm going to be wr

Re: String concatenation vs. string formatting

2011-07-09 Thread Andrew Berg
On 2011.07.09 06:06 AM, Vinay Sajip wrote: > In a logging context at least, using the form like > > logger.debug("formatting message with %s", "arguments") > > rather than > > logger.debug("formatting message with %s" % "arguments") How would I do that with the newer formatting? I've tried: > logge

Re: How can I make a program automatically run once per day?

2011-07-09 Thread Andrew Berg
On 2011.07.09 07:26 PM, John Salerno wrote: > I have a script that does some stuff that I want to run every day for > maybe a week, or a month. So far I've been good about running it every > night, but is there some way (using Python, of course) that I can make > it automatically run at a set time

Re: Newbie help - Programming the Semantic Web with Python

2011-07-09 Thread Andrew Berg
On 2011.07.09 08:32 PM, Bruce Whealton wrote: > Hello, > So, I got this book on Programming the Semantic Web about > the same time I started learning Python. The code seems to be > developed for python 2.7 and not 3, I believe. If you're going to learn Python 3, I suggest learning from

Re: String concatenation vs. string formatting

2011-07-09 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.09 09:54 PM, Dennis Lee Bieber wrote: > "file" is a built-in (related to "open"). It is? What is it? >>> type(file) Traceback (most recent call last): File "", line 1, in NameError: name 'file' is not defined I don't see it in

Re: String concatenation vs. string formatting

2011-07-09 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.09 09:54 PM, Dennis Lee Bieber wrote: > "file" is a built-in (related to "open"). Also: > Traceback (most recent call last): File > "C:\Users\Bahamut\workspace\Disillusion\disillusion.py", line 178, in > save_preset() File > "C:\Users\

Re: String concatenation vs. string formatting

2011-07-09 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.09 11:04 PM, Andrew Berg wrote: > > Is barf built-in as well? > That came off more hostile than I wanted, so I'll rephrase it: I doubt it has anything to do with built-ins, since it fails on a variable name that obvi

<    1   2   3   4   >