Making safe file names

2013-05-07 Thread Andrew Berg
Currently, I keep Last.fm artist data caches to avoid unnecessary API calls and have been naming the files using the artist name. However, artist names can have characters that are not allowed in file names for most file systems (e.g., C/A/T has forward slashes). Are there any recommended strateg

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 17:18, Fábio Santos wrote: > I suggest Base64. b64encode > (http://docs.python.org/2/library/base64.html#base64.b64encode) and > b64decode take an argument which allows you to eliminate the pesky "/" > character. It's reversible and simple. > > More suggestions: how about a hash? Or

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 17:01, Terry Jan Reedy wrote: > Sounds like you want something like the html escape or urlencode > functions, which serve the same purpose of encoding special chars. > Rather than invent a new tranformation, you could use the same scheme > used for html entities. (Sorry, I forget t

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 17:37, Jens Thoms Toerring wrote: > You > could e.g. replace all characters not allowed by the file > system by their hexidecimal (ASCII) values, preceeded by a > '%" (so '/' would be changed to '%2F', and also encode a '%' > itself in a name by '%25'). Then you have a well-defined >

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 19:14, Dave Angel wrote: > You also need to decide how to handle Unicode characters, since they're > different for different OS. In Windows on NTFS, filenames are in > Unicode, while on Unix, filenames are bytes. So on one of those, you > will be encoding/decoding if your code is

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 20:28, Neil Hodgson wrote: > http://support.microsoft.com/kb/74496 > http://en.wikipedia.org/wiki/Nul_%28band%29 I can indeed confirm that at least 'nul' cannot be used as a filename. However, I add an extension to the file names to identify them as caches. -- CPython 3.3.1 | Windo

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 20:45, Dave Angel wrote: > While we're looking for trouble, there's also case insensitivity. > Unclear if the user cares, but tom and TOM are the same file in most > configurations of NT. Artist names on Last.fm cannot differ only in case. This does remind me to make sure to update

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 20:13, Dave Angel wrote: > So you're comfortable typing arbitrary characters? what about all the > characters that have identical displays in your font? Identification is more important than typing. I can copy and paste into a terminal if necessary. I don't foresee typing out one o

Re: Making safe file names

2013-05-07 Thread Andrew Berg
On 2013.05.07 22:40, Steven D'Aprano wrote: > There aren't any characters outside of UTF-8 :-) UTF-8 covers the entire > Unicode range, unlike other encodings like Latin-1 or ASCII. You are correct. I'm not sure what I was thinking. >> I don't understand. I have no intention of changing Unicode c

Re: Making safe file names

2013-05-08 Thread Andrew Berg
On 2013.05.08 19:16, Roy Smith wrote: > Yup. At Songza, we deal with this crap every day. It usually bites us > the worst when trying to do keyword searches. When somebody types in > "Blue Oyster Cult", they really mean "Blue Oyster Cult", and our search > results need to reflect that. Likew

Re: Making safe file names

2013-05-11 Thread Andrew Berg
On 2013.05.08 18:37, Dennis Lee Bieber wrote: > And now you've seen why music players don't show the user the > physical file name, but maintain a database mapping the internal data > (name, artist, track#, album, etc.) to whatever mangled name was needed > to satisfy the file system. Tags ar

Re: Differences of "!=" operator behavior in python3 and python2 [ bug? ]

2013-05-13 Thread Andrew Berg
On 2013.05.13 17:53, Mark Lawrence wrote: > I much prefer the alternative <> for != but some silly people insisted > that this be removed from Python3. It's not removed from Python 3, though: Python 3.3.1 (v3.3.1:d9893d13c628, Apr 6 2013, 20:30:21) [MSC v.1600 64 bit (AMD64)] on win32 Type "hel

Re: python sockets question

2013-05-15 Thread Andrew Berg
On 2013.05.15 20:47, Eric Miller wrote: > Can python sockets be used to capture IP traffic when the traffic is > originating from a non-python source? Python just exposes the underlying OS socket interface. There is nothing special about sockets in Python. The whole point is to connect heterogene

Re: Python for philosophers

2013-05-15 Thread Andrew Berg
Tim Daneliuk wrote: > All You People are making this way too hard. To understand how > questions like the OPs ought be resolved, please read: > > http://pvspade.com/Sartre/cookbook.html On this list, I would expect a Sartre reference to be something like this: https://www.youtube.com/watch?v

Re: executing python scripts that are symlinked

2013-05-16 Thread Andrew Berg
On 2013.05.16 02:48, Charles Smith wrote: > Hi. > > How can I say, from the cmd line, that python should take my CWD as my > CWD, and not the directory where the script actually is? > > > I have a python script that works fine when it sits in directory WC, > but if I move it out of WC to H and p

Re: How to raise a socket "104 connection reset by peer error"

2013-05-21 Thread Andrew Berg
On 2013.05.21 10:26, loial wrote: > For testing purposes I want my code to raise a socket "connection reset by > peer" error, so that I can test how I handle it, but I am not sure how to > raise the error. Arbitrary exceptions can be raised with the raise keyword. In Python 3.3, that exact error

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Andrew Berg
On 2013.05.21 14:26, Mark Lawrence wrote: > On 21/05/2013 20:13, Skip Montanaro wrote: >>> Thank you, but let me rephrase it. I'm already using str.format() but I'd >>> like to use '%' (BINARY_MODULO) operator instead. >> >> That's unlikely to change. If not deprecated already string >> interpola

Re: PEP 378: Format Specifier for Thousands Separator

2013-05-21 Thread Andrew Berg
On 2013.05.21 21:59, Steven D'Aprano wrote: > On Tue, 21 May 2013 14:53:54 -0500, Andrew Berg wrote: > >> On 2013.05.21 14:26, Mark Lawrence wrote: > >>> Please stop perpetuating this myth, see >>> http://mail.python.org/pipermail/python-dev/

Re: Accessing Json data (I think I am nearly there) complete beginner

2013-05-23 Thread Andrew Berg
On 2013.05.23 11:09, Andrew Edwards-Adams wrote: > I was recommended to use the following code to access the Json data directly, > however I cannot get it to return anything. Where exactly is the problem? Do you not get JSON back? Do you get the wrong values? Do you get a KeyError or IndexError t

Re: Accessing Json data (I think I am nearly there) complete beginner

2013-05-23 Thread Andrew Berg
On 2013.05.23 11:58, Andrew Edwards-Adams wrote: > If there was a trackback/debug I might know where to look, but its not > yielding errors, its simply yielding nothing. What i dont know, is if it is > the code that isnt working, or what I am inputting in the " print > text1['rows'][0]['id']" th

Re: Accessing Json data (I think I am nearly there) complete beginner

2013-05-23 Thread Andrew Berg
On 2013.05.23 11:58, Andrew Edwards-Adams wrote: > Hi thanks for the reply Andrew, my first bit of code was heading in the right > direction I was managing to pull out the usernames from the JSON, using REGEX. It's also worth mentioning that regexes are almost always the wrong tool, especially fo

Re: Prepending string "@" to usernames

2013-05-24 Thread Andrew Berg
On 2013.05.24 17:53, Thomas Murphy wrote: > I know I'm iterating wrong. May I ask how? .split() already returns a list, so instead of iterating over the list and getting a single username, you iterate over the list and get a single list. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- ht

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Andrew Berg
On 2013.05.26 14:10, Daniel Gagliardi wrote: > I want to know how to implement concurrent threads in Python With the threading module in the standard library. http://docs.python.org/3.3/library/threading.html There are plenty of tutorials on this out there; we'll be happy to help if you're stuck

Re: I want to know how to implement concurrent threads in Python

2013-05-26 Thread Andrew Berg
On 2013.05.26 16:21, Daniel Gagliardi wrote: > shutup bitch! i do know python cannot concurrent threads. want a workaround You're a charming fellow. I'm sure everyone will flock to help you. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: The problem with "print"

2013-06-02 Thread Andrew Berg
I don't think you go far enough. Obviously we need way more flexibility. A simple on/off is okay for some things, but a finer granularity would be really helpful because some things are more important than others. And why stop at stdout/stderr? We need to add a consistent way to output these mess

Re: Re-using copyrighted code

2013-06-08 Thread Andrew Berg
On 2013.06.08 16:31, Malte Forkel wrote: > Hello, > > I have written a small utility to locate errors in regular expressions > that I want to upload to PyPI. Before I do that, I would like to learn > a litte more about the legal aspects of open-source software. What would > be a good introductory

Re: Re-using copyrighted code

2013-06-08 Thread Andrew Berg
On 2013.06.08 17:09, Benjamin Kaplan wrote: > On Sat, Jun 8, 2013 at 2:31 PM, Malte Forkel wrote: >> # This version of the SRE library can be redistributed under CNRI's >> # Python 1.6 license. For any other use, please contact Secret Labs >> # AB (i...@pythonware.com). >> # >> # Portions of this

Re: My son wants me to teach him Python

2013-06-12 Thread Andrew Berg
On 2013.06.12 23:47, Rick Johnson wrote: > 1. Rock is dead... Nah, he just does movies now. Seriously, though, GUI stuff might be okay to learn early on since he's interested in making games. There's no reason to focus heavily on it this early, however. -- CPython 3.3.2 | Windows NT 6.2.9200 /

Re: A few questiosn about encoding

2013-06-20 Thread Andrew Berg
On 2013.06.20 08:40, Rick Johnson wrote: > One the most humorous aspects of Unicode is that it has > encodings for Braille characters. Hmm, this presents a > conundrum of sorts. RIDDLE ME THIS?! > > Since Braille is a type of "reading" for the blind by > utilizing the sense of touch (there

Re: newbie EOL while scanning string literal

2013-06-25 Thread Andrew Berg
On 2013.06.25 17:19, willlewis...@gmail.com wrote: > na=('type first integer n\')##THE RED SHADOW APPEARS HERE## Here you escape the closing single quote. \n is a line feed, not n\. Also, the parentheses are unnecessary, and it looks like you are a assigning a tuple instead of a string. Syntax err

Why is the argparse module so inflexible?

2013-06-27 Thread Andrew Berg
I've begun writing a program with an interactive prompt, and it needs to parse input from the user. I thought the argparse module would be great for this, but unfortunately it insists on calling sys.exit() at any sign of trouble instead of letting its ArgumentError exception propagate so that I c

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Andrew Berg
On 2013.06.27 08:08, Roy Smith wrote: > Can you give us a concrete example of what you're trying to do? The actual code I've written so far isn't easily condensed into a short simple snippet. I'm trying to use argparse to handle all the little details of parsing and verifying arguments in the pre

Re: Why is the argparse module so inflexible?

2013-06-27 Thread Andrew Berg
I appreciate the responses from everyone. I knew I couldn't be the only who thought this behavior was unnecessarily limiting. I found a ticket on the bug tracker. A patch was even submitted, but obviously it didn't make it into 3.3. Hopefully, it will make it into 3.4 with some prodding. http://

Re: Why is the argparse module so inflexible?

2013-06-28 Thread Andrew Berg
After getting over the hurdles I initially explained and moving forward, I've found that standard command-line parsing and its conventions are far too ingrained in the design of argparse to make it useful as a general command parser. I think I would end up overriding a substantial amount of the m

Re: Why is the argparse module so inflexible?

2013-06-29 Thread Andrew Berg
On 2013.06.29 09:12, Roy Smith wrote: > What is the tracker issue number or url? http://bugs.python.org/issue9938 -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list

Re: math functions with non numeric args

2013-06-30 Thread Andrew Berg
On 2013.06.30 13:46, Andrew Z wrote: > Hello, > > print max(-10, 10) > 10 > print max('-10', 10) > -10 > > My guess max converts string to number bye decoding each of the characters to > it's ASCII equivalent? > > Where can i read more on exactly how the situations like these are dealt with? Th

Re: python adds an extra half space when reading from a string or list

2013-07-01 Thread Andrew Berg
On 2013.07.01 08:28, Νίκος wrote: > So, Steven you want me to sit tight and read all the insults coming from > this guy? > > If that happened to you, wouldn't you feel the need and urge to reply > back and stand for yourself? You can ignore it (this is the best solution) or you can take it off-l

Re: How to tell Script to use pythonw.exe ?

2013-07-02 Thread Andrew Berg
On 2013.07.02 20:20, goldtech wrote: > Using Windows > > I want to run a .py file script using pythonw.exe so the DOS box will not > open. Is there a way from inside the script to say "run me with pythonw.exe > and not python.exe"? Use the .pyw extension instead of .py. Also, just FYI, DOS i

Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]

2013-07-03 Thread Andrew Berg
On 2013.07.03 02:34, Tim Golden wrote: > While this is clearly true, it's by no means unusual for people to refer > to the "DOS Box" or talk about "DOS commands" etc. even when they're > quite well aware of the history of Windows and its Console subsystem. > It's just quicker than saying "Console W

Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]

2013-07-04 Thread Andrew Berg
On 2013.07.04 09:08, Wayne Werner wrote: > powershell -ExecutionPolicy Bypass -File ... > > > \o/ > > Microsoft "security" at it again! (reminds me a bit of just pushing > "Cancel" to log into windows 98, I think it was) From an MSDN page linked in one of the answers: > Now, why is > > Pow

Re: Help with 'self' and 'set_usage'

2013-07-09 Thread Andrew Berg
On 2013.07.09 12:03, L O'Shea wrote: > Could anyone shed some light on this? I can't find mention of this anywhere > in any Python documentation or anywhere else in the code where usage_str > might be defined. In Python, you don't declare or initialize variables before using them. In the example

Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

2013-07-17 Thread Andrew Berg
On 2013.07.18 01:36, Aseem Bansal wrote: > I learnt Python myself and everyone told me that Python 2 is status quo so I > learned Python 2 and have been working with it. I am just 1.5 months in > Python programming so should I consider switching to Python 3 if it helps > with new things or shoul

Re: None shown in output

2012-06-21 Thread Andrew Berg
On 6/21/2012 10:42 PM, Xander Solis wrote: > Hello Python list, > > Noob here with a newbie question. I'm reading and working on the > exercise of the book, Learn Python the Hard way 2.0. When I use this > code, I get "None" on the output. My question is why does this happen? Your function prints

Re: Why is python source code not available on github?

2012-06-23 Thread Andrew Berg
On 6/23/2012 7:16 PM, gmspro wrote: > Why is python source code not available on github? If you mean CPython, it's because the devs use Mercurial and have their own hosting on python.org. hg clone http://hg.python.org/cpython http://docs.python.org/devguide/setup.html github is far from the only

Re: exception problem

2012-06-24 Thread Andrew Berg
On 6/25/2012 12:27 AM, Charles Hixson wrote: > The documentation section covering the except statement could stand to > be a *LOT* clearer. I read the sections on the except statement and > exception handlers several times and couldn't figure out was the "as" > argument of the except statement

Re: Why has python3 been created as a seperate language where there is still python2.7 ?

2012-06-25 Thread Andrew Berg
On 6/23/2012 10:46 PM, gmspro wrote: > What's wrong editing/customizing/changin python2.7 instead of making a > seperate language? py3k is not a separate language. In fact, it is possible to maintain a codebase that supports 2.2 (maybe even older), 3.3, and every version in between. > What's wrong

Re: Following syntax error in Mac OX10.7 Terminal

2012-06-28 Thread Andrew Berg
On 6/28/2012 12:11 PM, David Thomas wrote: > Hi, > I have the following error regarding a loop tutorial found on > http://www.sthurlow.com/python/lesson04/ > a=0 while a<10: > ... a=a+1 > File "", line 2 > a=a+1 > ^ > IndentationError: expected an indented block You indented

Re: Re Following syntax error in Mac OX10.7 Terminal

2012-06-29 Thread Andrew Berg
On 6/29/2012 10:58 AM, David Thomas wrote: > Just discovered this in the tutorial further down. I'm currently learning > Python 2 because there seems to be a lot of tutorials out there covering > Python 2 rather than 3. The latest edition (3rd?) of Programming Python by Mark Lutz covers py3k (it

Re: when "normal" parallel computations in CPython will be implemented at last?

2012-07-01 Thread Andrew Berg
On 7/1/2012 1:53 PM, Thomas Jollans wrote: > As far as I can tell, there are no concrete plans to integrate > concurrency better, or get rid of the GIL, at the moment. To quote > http://wiki.python.org/moin/GlobalInterpreterLock > > """Getting rid of the GIL is an occasional topic on the python-

Re: helping with unicode

2012-07-02 Thread Andrew Berg
On 7/2/2012 7:49 PM, self.python wrote: > > Traceback (most recent call last): > File "C:wrong.py", line 8, in > print rf.read().decode('utf-8') > UnicodeEncodeError: 'cp949' codec can't encode character u'u1368' in position >

Implicit conversion to boolean in if and while statements

2012-07-15 Thread Andrew Berg
This has probably been discussed before, but why is there an implicit conversion to a boolean in if and while statements? if not None: print('hi') prints 'hi' since bool(None) is False. If this was discussed in a PEP, I would like a link to it. There are so many PEPs, and I wouldn't know

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Andrew Berg
On 7/15/2012 5:56 AM, Steven D'Aprano wrote: > 3) Rather than distinguishing "true" from "false", a more useful > dichotomy is between "something" and "nothing". Python includes a number > of ways of spelling "nothing" of various types, such as: > > None, 0, 0.0, '', [], {}, set() > > and n

Re: Implicit conversion to boolean in if and while statements

2012-07-15 Thread Andrew Berg
On 7/15/2012 11:19 AM, Ian Kelly wrote: > Ugh, that's irritating. I can't think of any scenario where I would > ever want the semantics "if timeval (is not midnight):". It's not implemented with such a test, but logging.handlers.TimedRotatingFileHandler has an option to rollover at midnight. -- C

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Andrew Berg
On 7/15/2012 9:38 PM, Steven D'Aprano wrote: >> I would expect None to mean "doesn't exist" or "unknown" or >> something like that - e.g., a value of 0 means 0 jelly beans in the jar >> and None means there isn't a jar. > > How you interpret some_variable = None depends on what some_variable > re

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Andrew Berg
On 7/15/2012 3:28 PM, Terry Reedy wrote: > Because everything does (or should). I can see how truth testing for empty values is convenient, but perhaps objects should only have a truth value if explicitly given one - particularly in cases where such a value wouldn't be obvious or the obvious value

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Andrew Berg
On 7/16/2012 7:43 PM, Steven D'Aprano wrote: > The existence of a jar or no jar is irrelevant to the question of how > many jellybeans there are. They are two different things, and therefore > need two different values. There are many ways to implement this. I have a better real example, but I op

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Andrew Berg
On 7/16/2012 11:11 PM, Steven D'Aprano wrote: > If you are right that SimpleNamespace should be treated as a container, > then it should implement container semantics. Since it doesn't, that is > either: > > 1) a bug; or > 2) a triumph of laziness over correctness > > I imagine though that the

Re: Implicit conversion to boolean in if and while statements

2012-07-16 Thread Andrew Berg
On 7/16/2012 11:39 PM, Steven D'Aprano wrote: > If you need three (or four, or fifty) > distinguishable states, then obviously boolean context will not solve > your problem. I never said it would. That is the impression I got from this statement: > How you interpret some_variable = None depends

Re: Implicit conversion to boolean in if and while statements

2012-07-17 Thread Andrew Berg
On 7/17/2012 2:08 AM, Steven D'Aprano wrote: > The default behaviour is that every object is something, hence true-like, > unless explicitly coded to be treated as false-like. Since both loggers > and functions are objects, they are true-like unless the default is > overridden. I am aware of the

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 6:01 AM, Lipska the Kat wrote: > Anyway, I'm looking at Python as a rapid prototyping language. > I have an idea and just want to get it down in basic outline code as > quickly as possible before it departs my aging brain... I'm not used to > using variables without declaring their t

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 6:44 AM, Lipska the Kat wrote: > I'll check it out, thanks. I forgot to add this: http://wiki.python.org/moin/Python2orPython3 It's a little outdated (there is more progress toward py3k by 3rd-party libraries every day), but still quite helpful. -- CPython 3.3.0b1 | Windows NT 6.1.76

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 9:01 AM, Lipska the Kat wrote: > Wow, that was a blast from the past > Just downloaded, unzipped, untarred, configured, made and installed > python 3.2.3 ... it's YEARS since I've done this, makes me feel young again. Most Linux distributions should have a premade package for stable P

Re: Encapsulation, inheritance and polymorphism

2012-07-17 Thread Andrew Berg
On 7/17/2012 12:30 PM, Terry Reedy wrote: > (In some ways, it is already better than 3.2.3.) I certainly make heavy use of some of the new features. I'm not sure we can have enough separate exceptions for OS errors without exhausting every possibility and I might start looking for excuses to use th

Re: Encapsulation, inheritance and polymorphism

2012-07-18 Thread Andrew Berg
On 7/18/2012 9:34 AM, Grant Edwards wrote: > people who us tabs are wrong Don't make me get my flamethrower! > and people who mix spaces and tabs -- well, we don't > talk about them in polite company. Mixing can make sense, but not in Python. *hides* -- CPython 3.3.0b1 | Windows NT 6.1.7601.1780

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Andrew Berg
On 7/21/2012 2:33 AM, Jan Riechers wrote: > Block > ... > versus this block: > ... > Now, very briefly, what is the better way to proceed in terms of > execution speed, readability, coding style? Using if/else is the most readable in the general sense. Using return (or break or continue as applica

Re: Basic question about speed/coding style/memory

2012-07-21 Thread Andrew Berg
On 7/21/2012 3:13 AM, Jan Riechers wrote: > Cause, as I understand the interpreter chooses either the "else" (1st > block) or just proceeds with following code outside the if. If none of the if/elif statements evaluate to something true, the else block is executed. > So if there is some overhead

Re: Sudden doubling of nearly all messages

2012-07-21 Thread Andrew Berg
On 7/21/2012 5:48 AM, Dave Angel wrote: > Has anybody else noticed the sudden double-posting of nearly all > messages in the python mailing list? I am also using the mailing list, but I haven't experienced this. -- CPython 3.3.0b1 | Windows NT 6.1.7601.17803 -- http://mail.python.org/mailman/list

Re: My first ever Python program, comments welcome

2012-07-22 Thread Andrew Berg
On 7/22/2012 3:37 AM, Lipska the Kat wrote: > Many in > the Linux world seem to use git. Seeing as I've been using Linux at home > since the early days of slackware I suppose I'd better look into it. There are Mercurial (aka Hg) and Bazaar as well for DVCS. AFAIK, git, Mercurial, and Bazaar are a

Re: catch UnicodeDecodeError

2012-07-25 Thread Andrew Berg
On 7/25/2012 6:05 AM, jaroslav.dob...@gmail.com wrote: > What I really want to do is use something like > > try: > # open file, read line, or do something else, I don't care > except UnicodeDecodeError: > sys.exit("Found a bad char in file " + file + " line " + str(line_number) > > Yet, n

Re: Is Python a commercial proposition ?

2012-07-29 Thread Andrew Berg
On 7/29/2012 7:12 PM, Rodrick Brown wrote: > Python is a glue language much like Perl was 10 years ago. Until the > GIL is fixed I doubt anyone will seriously look at Python as an option > for large enterprise standalone application development. The GIL is neither a bug to be fixed nor an inherent

Firefox 3.6 [OT] (was: Re: [ANN] pyknon: Simple Python library to generate music in a hacker friendly way.)

2012-07-31 Thread Andrew Berg
On 7/30/2012 9:25 PM, Steven D'Aprano wrote: > I don't. But in my experience, the risk of security breaches is *much* > less than the chance that the new version will break functionality, > introduce bugs, have a worse user interface, and generally be a step > backwards rather than forward. 4.0

Re: Intermediate Python user needed help

2012-08-05 Thread Andrew Berg
On 8/5/2012 2:51 PM, John Mordecai Dildy wrote: > print "We'd have %d beans, %d jars, and %d crabapples." % > secret_formula(start_pont > sentence = "All good things come to those who wait." You are missing a parenthesis at the end of the previous line. > .print_first_word(sorted_words) That dot

Re: Which Version of Python?

2012-09-11 Thread Andrew Berg
On 2012.09.11 19:17, Peter wrote: > If your desire is to "learn" Python then I would stick to 2.7 > > My reasoning would be that there are still a significant number of packages > that have not been ported to 3.x (and may never be ported). This is true, but the /potential/ for the need for one of

Re: portable way of locating an executable (like which)

2012-09-20 Thread Andrew Berg
On 2012.09.20 21:31, Dave Angel wrote: > I don't have a Windows machine set up right now, but I believe there are > two more directories to search, besides the ones described in the PATH > variable. > > One is the current directory, and the other is the Windows directory > (maybe also the xxx/syst

Re: Functional way to compare things inside a list

2012-09-22 Thread Andrew Berg
On 2012.09.22 02:08, Jamie Paul Griffin wrote: > I find this intriguing, I had no idea bots existed to post to mailing > lists in this way. What's the point of them? To amuse their owners is my guess. -- CPython 3.3.0rc2 | Windows NT 6.1.7601.17835 -- http://mail.python.org/mailman/listinfo/pyth

Re: EOL for Python 3.2?

2012-09-29 Thread Andrew Berg
On 2012.09.29 15:03, David Dillard wrote: > With the release of Python 3.3.0 does that mean the 3.2.x line is now end of > life? No. Old releases get security fixes for years. > I've looked for some sort of end of life policy on python.org, but was unable > to find one. http://www.python.org/dow

Re: Coexistence of Python 2.x and 3.x on same OS

2012-09-30 Thread Andrew Berg
On 2012.09.30 14:14, Edward Diener wrote: > The situation is so confusing on Windows, where the file associations, > registry entries, and other internal software which allows a given > Python release to work properly when invoking Python is so complicated, > that I have given up on trying to in

Re: Coexistence of Python 2.x and 3.x on same OS

2012-09-30 Thread Andrew Berg
On 2012.09.30 22:06, Edward Diener wrote: > The problem with that is that one has to already being using 3.3 to use > this facility. I was hoping for a solution which was backwards > compatible with Python 2.x. It's a separate tool that comes with 3.3. You can install 3.3 and never use the actual

Re: How to execute commands on a windows machine from a Linux machine

2012-10-03 Thread Andrew Berg
On 2012.10.04 00:13, Shambhu Rajak wrote: > Here i have two questions, > > 1. I want to write a framework for Linux machine that can execute > commands on windows machine: > > How to create a persistent shell between Linux and Windows machine. > > 2. I require to extract windows dis

Re: Right solution to unicode error?

2012-11-07 Thread Andrew Berg
On 2012.11.07 17:27, Oscar Benjamin wrote: > Are you using cmd.exe (standard Windows terminal)? If so, it does not > support unicode Actually, it does. Code page 65001 is UTF-8. I know that doesn't help the OP since Python versions below 3.3 don't support cp65001, but I think it's important to poin

Re: Right solution to unicode error?

2012-11-08 Thread Andrew Berg
On 2012.11.08 08:06, Oscar Benjamin wrote: > It would be a lot better though if it just worked straight away > without me needing to set the code page (like the terminal in every > other OS I use). The crude equivalent of .bashrc/.zshrc/whatever shell startup script for cmd is setting a string valu

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 11:17, danielk wrote: > I'm converting an application to Python 3. The app works fine on Python 2. > > Simply put, this simple one-liner: > > print(chr(254)) > > errors out with: > > Traceback (most recent call last): > File "D:\home\python\tst.py", line 1, in > print(chr(2

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 15:17, danielk wrote: > I guess the question I have is: How do you tell Python to use a specific > encoding for 'print' statements when I know there will be characters outside > of the ASCII range of 0-127? You don't. It's raising that exception because the terminal cannot display t

Re: EOFError why print(e) cannot print out any information ?

2012-12-25 Thread Andrew Berg
On 2012.12.25 23:26, iMath wrote: > why print(e) cannot print out any information ? If you want to manipulate tracebacks, use sys.exc_info() and the traceback module from the standard library. The logging module also comes with an exception() function and an exception() method for Logger objects th

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-28 Thread Andrew Berg
On 2012.12.28 00:51, Jamie Paul Griffin wrote: > The benefit of the tmux client (terminal multiplexer) is that I can see > all the screens at the same time and quickly switch between them. I > believe Linux has screen(1) which does the same thing. tmux is generally easily available for Linux, and

Re: Source code of Windows installer for Python interactive interpreter

2012-12-28 Thread Andrew Berg
On 2012.12.28 09:30, philip.a.mol...@gmail.com wrote: > Is the Python directory (i.e. "C:\Python33") assigned to the PATH variable > using the Batch PATH built-in command? If so, where? As of Python 3.3, there is a py.exe in the system32 directory that launches the appropriate version of Python fo

Re: father class name

2012-12-30 Thread Andrew Berg
On 2012.12.30 22:18, contro opinion wrote: > here is my haha class > class haha(object): > def theprint(self): > print "i am here" > haha().theprint() > i am here haha(object).theprint() > Traceback (most recent call last): > File "", line 1, in > TypeError: object.__new__()

Re: pygame - importing GL - very bad...

2013-01-02 Thread Andrew Berg
On 2013.01.02 15:57, Michael Torrie wrote: > Why is this solution not to your liking? Python has namespaces for a > reason. They both keep code separated and modular. Use them. At most > you should import the most commonly-used symbols only, and refer to the > rest through their respective name

Important questions about __future__

2013-01-03 Thread Andrew Berg
Does 'from __future__ import barry_as_FLUFL' do anything? Despite PEP 401, using print as a statement still raises a SyntaxError. Where is 'from __future__ import braces' implemented in CPython (it's not in __future__.py)? -- CPython 3.3.0 | Windows NT 6.2.9200.16461 -- http://mail.python.org/mai

Re: python wiki gone?

2013-01-05 Thread Andrew Berg
On 2013.01.05 13:07, Lee Harr wrote: > When I go to wiki.python.org I get redirected to > http://wiki.python.org/moin/ > which is 404 Not Found. There's a security issue with moinmoin. The Python wiki is not the only wiki offline for this reason. -- CPython 3.3.0 | Windows NT 6.2.9200.16461 / Free

Re: environment fingerprint

2013-01-29 Thread Andrew Berg
On 2013.01.29 07:18, Jabba Laci wrote: > Hi, > > I have a script that I want to run in different environments: on > Linux, on Windows, on my home machine, at my workplace, in virtualbox, > etc. In each environment I want to use different configurations. For > instance the temp. directory on Linux

Re: The devolution of English language and slothful c.l.p behaviors exposed!

2012-01-23 Thread Andrew Berg
You're right, but it's pretty hard for some people to do what they're supposed to when it isn't what they're used to. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Re: PyPI - how do you pronounce it?

2012-01-28 Thread Andrew Berg
On 1/28/2012 1:48 AM, Chris Angelico wrote: > How do you pronounce PyPI? > * Pie-Pea-Eye? This, primarily because it represents 3 words, and secondarily to eliminate confusion with PyPy. -- CPython 3.2.2 | Windows NT 6.1.7601.17640 -- http://mail.python.org/mailman/listinfo/python-list

Script randomly exits for seemingly no reason with strange traceback

2012-02-03 Thread Andrew Berg
It's a rare occurrence, but sometimes my script will terminate and I get this: Traceback (most recent call last): File "C:\path\to\script\script.py", line 992, in That's it. And the line number is always the last line of the file (which in my case is a blank line). I have not seen this on Linu

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

2012-02-04 Thread Andrew Berg
On 2/3/2012 5:25 PM, Steven D'Aprano wrote: > Which version of Python, which version of Windows? I keep that information in my signature for every post I make to this list. CPython 3.2.2 | Windows NT 6.1.7601.17640 > If you upgrade Python, does the problem go away? I use the most recent stable ver

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

2012-02-04 Thread Andrew Berg
On 2/4/2012 11:06 AM, Steven D'Aprano wrote: > I suggest you raise an issue on the bug tracker. If you can't reproduce > the bug, it's unlikely to be fixed, but you might get lucky. Since I can't narrow it down to any specific circumstance or code, I'll gather information from a build of the inter

Re: Help about dictionary append

2012-02-05 Thread Andrew Berg
On 2/5/2012 9:13 AM, Anatoli Hristov wrote: > and I get and error that TUPLE object has no attribute Append !!! You defined mydict['name'] as a tuple, and tuples are immutable. Using a tuple means that you don't ever want the values to change. > But how to add new Values to a dictionary then ? Thi

Re: unicode printing on Windows

2012-02-09 Thread Andrew Berg
On 2/9/2012 4:46 AM, BlueBird wrote: > Does anybody know how to fix problem 1 ? That way, I could at least > deal with programs that print UTF8 on stdout. I'm pretty sure there isn't a way. cp65001 is supposed to be UTF-8, but it doesn't work in my experience (I fed it some UTF-8 demo text and I go

Building a debug version of Python 3.2.2 under Windows

2012-02-11 Thread Andrew Berg
I tried to build Python 3.2.2 with VS 2008, but it seems I'm missing some header files (e.g. sqlite3, openssl). Is there a nice little package with all the dependencies, or do I need to grab source code packages for each program from their respective websites, or something else entirely? -- CPyth

Re: Building a debug version of Python 3.2.2 under Windows

2012-02-11 Thread Andrew Berg
On 2/11/2012 3:01 PM, Terry Reedy wrote: > The readme file in PCBuild supposedly has all the info needed, though I > know one thing out of date. Trying to follow the instructions is on my > todo list ;-). > I didn't notice the readme in there. I was following instructions from here: http://docs.

  1   2   3   4   >