Re: Remote Rsponse Socket Connection

2016-03-11 Thread Andrew Berg
On 2016.03.11 07:17, Joaquin Alzola wrote: > HI Guys > > I received this from a socket connection. This is the received data: > > Adding more info --> the response is a mixture of hex numbers + ascii > > From python function --> data = s.recv(2048) > > b'\x01\x00\x00D\x00\x00\x01\x18\x00\x00\x0

Re: Using + with strings considered bad

2015-04-29 Thread Andrew Berg
On 2015.04.29 04:08, Mark Lawrence wrote: > On 29/04/2015 09:29, Cecil Westerhof wrote: >> Because I try to keep my lines (well) below 80 characters, I use the >> following: >> print('Calculating fibonacci and fibonacci_memoize once for ' + >>str(large_fibonacci) + ' to determine s

Re: Python 3 lack of support for fcgi/wsgi.

2015-03-29 Thread Andrew Berg
On 2015.03.29 13:57, John Nagle wrote: > There's "wsgiref", which looks more promising, but has a different > interface. That's not what the Python documentation recommends as > the first choice, but it's a standard module. Oh? > These days, FastCGI is never used directly. Just like mod_python, i

Re: Concatenate list values

2015-02-23 Thread Andrew Berg
On 2015.02.23 09:58, loial wrote: > Is there a quick way to concatenate all the values in a list into a string, > except the first value? > > I want this to work with variable length lists. > > All values in list will be strings. > > Any help appreciated > The tutorial covers strings and lists

Re: How to "wow" someone new to Python

2015-01-16 Thread Andrew Berg
On 2015.01.16 09:03, Chris Angelico wrote: > Scenario: You're introducing someone to Python for the first time. > S/he may have some previous programming experience, or may be new to > the whole idea of giving a computer instructions. You have a couple of > minutes to show off how awesome Python is

Re: Function passed as an argument returns none

2014-10-01 Thread Andrew Berg
On 2014.10.01 17:37, Shiva wrote: > Only 'None' gets passed on to parameter 'got' instead of the expected value > of 4. > Any idea why 'None' is getting passed even though calling the donuts(4) > alone returns the expected value? donuts() prints what you tell it to ("Number of donuts: 5"), and then

Re: When does True == True

2014-08-28 Thread Andrew Berg
On 2014.08.28 15:38, Seymore4Head wrote: > What am I doing wrong? >>> True == True True >>> True == "True" False >>> type(True) >>> type("True") Also, if is already a boolean test, and it is more Pythonic to simply write "if pigword.isalpha():". -- https://mail.python.org/mailman/listinfo/pytho

Password strategy [OT] was: PyPI password rules

2014-08-26 Thread Andrew Berg
On 2014.08.26 01:16, Chris Angelico wrote: > A huge THANK YOU to whoever set the rules for PyPI passwords! You're > allowed to go with a monocase password, as long as it's at least 16 > characters in length. Finally, someone who recognizes XKCD 936 > passwords! > > And yes, I generated an XKCD 936

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-04 Thread Andrew Berg
On 2014.08.04 04:46, Glenn Linderman wrote: > How does one "directly run" another application using ConEmu? That wasn't > clear > from what I found to read. It sounded like you run ConEmu, run one or more > shells within it, and launch programs from those shells? And so it was also > unclear if a

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Andrew Berg
On 2014.08.03 23:14, Glenn Linderman wrote: > Having read a bit about ConEmu, it seems that it is a "pretty face" built on > top of Windows Console, by screen scraping the real (but hidden) Windows > Console, and providing a number of interesting display features and modes. So > while it adds funct

Re: cmd.exe on WIndows - problem with displaying some Unicode characters

2014-08-03 Thread Andrew Berg
On 2014.08.03 18:08, Chris Angelico wrote: > The best way to do it is to use the Unicode codepage, but cmd.exe just > plain has issues. There are underlying Windows APIs for displaying > text that have problems with astral characters (I think that's what it > is), so ultimately, you're largely stuc

Re: OT: usenet reader software

2014-07-18 Thread Andrew Berg
On 2014.07.18 14:10, memilanuk wrote: > I'm on Ubuntu (14.04 LTS, if it matters) and I've been using Thunderbird > for a lng time... I've tinkered with slrn off and on over the years, > tried pan occasionally due to recommendations... but I keep ending up > back @ Thunderbird. About the onl

Re: Python 3.4.1 64 bit Version

2014-07-18 Thread Andrew Berg
On 2014.07.18 08:53, Zachary Ware wrote: > For the record, all versions of CPython on Windows (not counting > anything relating to cygwin) are "on win32" regardless of the > bittedness of the processor or the interpreter. > And in case you need more reassurance, there is the platform module in the

Re: Python 3 is killing Python

2014-07-17 Thread Andrew Berg
On 2014.07.17 19:26, Mark Lawrence wrote: > I'm looking forward to see the massive number of fixes that come from > rr, assuming of course that he signs the CLA to make this possible. Or > has he already done so? > Maybe he's too busy working on RickPy 4000 (or whatever it was called). -- http

Re: Python alternative to Google Groups

2014-05-28 Thread Andrew Berg
On 2014.05.28 16:54, Steven Clift wrote: > If you are looking for an open source alternative between Google > Groups and Mailman, I wanted to share: > > http://groupserver.org > > It has recent release and new design. > > Key is the assumption that any user can publish/reply via email or the

Re: Why Python 3?

2014-04-19 Thread Andrew Berg
On 2014.04.19 07:58, Ian Foote wrote: > Django has been there since 1.5. My company has been using python3 in > production since 1.6 was released. There have been a few other third > party libraries we've wanted to use but can't, but we've been able to > work around that. I guess I'm a bit behind t

Re: Why Python 3?

2014-04-18 Thread Andrew Berg
On 2014.04.18 22:28, Anthony Papillion wrote: > What is the general feel of /this/ community? I'm about to start a > large scale Python project. Should it be done in 2 or 3? What are the > benefits, aside from the 'it's the future' argument? Python 3 is not the future; it is the present. If you're

Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Andrew Berg
On 2014.04.16 03:02, Chris Angelico wrote: > Hmm, interesting. That's not the case for me: > > rosuav@sikorsky:~$ which which > /usr/bin/which That's because bash either does not have a builtin which or it is not enabled by default. I switched to zsh a while ago. I do still, of course, have a sys

Re: Martijn Faassen: The Call of Python 2.8

2014-04-16 Thread Andrew Berg
On 2014.04.15 20:21, Steven D'Aprano wrote: > On Tue, 15 Apr 2014 17:32:57 -0500, Andrew Berg wrote: > >> On 2014.04.15 17:18, Ned Batchelder wrote: >>> Yeah, that's the wrong way to do it, and they shouldn't have done that. >>> "python"

Re: Martijn Faassen: The Call of Python 2.8

2014-04-15 Thread Andrew Berg
On 2014.04.15 17:18, Ned Batchelder wrote: > Yeah, that's the wrong way to do it, and they shouldn't have done that. > "python" needs to mean Python 2.x for a long time. Or maybe explicit is better than implicit: # python zsh: command not found: python # which python2.7 /usr/local/bin/python2.7

Re: Martijn Faassen: The Call of Python 2.8

2014-04-15 Thread Andrew Berg
On 2014.04.15 16:02, Terry Reedy wrote: > https://python3wos.appspot.com/ There seems to be a difference of opinion between this page and the Twisted devs on what the "Python 2 only" classifier for PyPI means. -- CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mail

Re: threading

2014-04-09 Thread Andrew Berg
On 2014.04.09 18:53, Roy Smith wrote: > It's even more ambiguous in Spanish. Esta lloviendo. Not only do you > get to intuit the referrent, you get to intuit the pronoun too :-) And in this particular instance, you have to figure out that 'está' (verb) was meant instead of 'esta' (adjective). :

Re: Try-except-finally paradox

2014-01-29 Thread Andrew Berg
On 2014.01.29 23:56, Jessica Ross wrote: > I found something like this in a StackOverflow discussion. def paradox(): > ... try: > ... raise Exception("Exception raised during try") > ... except: > ... print "Except after try" > ... return True > ...

Re: Python 2.x and 3.x usage survey

2013-12-30 Thread Andrew Berg
On 2013.12.30 15:56, Dan Stromberg wrote: > I keep hearing naysayers, nay saying about Python 3.x. > > Here's a 9 question, multiple choice survey I put together about > Python 2.x use vs Python 3.x use. > > I'd be very pleased if you could take 5 or 10 minutes to fill it out. > > Here's the URL

Re: So, what's the real story on Python 2 vs Python 3?

2013-12-26 Thread Andrew Berg
On 2013.12.26 23:04, Travis McGee wrote: > The Python.org site says that the future is Python 3, yet whenever I try > something new in Python, such as Tkinter which I am learning now, > everything seems to default to Python 2. By this I mean that, whenever I > find that I need to install another

Re: Getting the Appdata Directory with Python and PEP?

2013-11-25 Thread Andrew Berg
On 2013.11.25 14:48, Eamonn Rea wrote: > I've heard that there is a library that allows you to get the appdata > directory for a given OS, but I'd like to do it myself, as a learning > experience. > > Is there a built in way to get a users Appdata Directory? For example on OS X > it's in '~/Lib

Re: How can I get the variable to subtract the input please?

2013-11-18 Thread Andrew Berg
On 2013.11.18 17:56, Ed Taylor wrote: > This will be very simple to most of you I guess but it's killing me! > > print ("Please type in your age") > age = input () > leave = 16 > print ("You have" + leave - age + "years left at school") > > I want to have an input where the users age is inserted

Re: grammar (was Re: Automation)

2013-11-16 Thread Andrew Berg
On 2013.11.16 22:16, Chris Angelico wrote: > I decided a while ago that my life would be alot better[1] For those who haven't yet seen it: http://hyperboleandahalf.blogspot.com/2010/04/alot-is-better-than-you-at-everything.html -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://ma

Re: grammar (was Re: Automation)

2013-11-16 Thread Andrew Berg
On 2013.11.16 11:02, Paul Smith wrote: > The one that really irks me is people using "loose" when they mean > "lose". These words are not related, and they don't sound the same. > Plus this mistake is very common; I typically see it at least once a > day. Don't be surprised if such people pronounc

Re: Re-raising a RuntimeError - good practice?

2013-10-24 Thread Andrew Berg
On 2013.10.24 20:09, Victor Hooi wrote: > Also, @Andrew Berg - you mentioned I'm just swallowing the original exception > and re-raising a new RuntimeError - I'm guessing this is a bad practice, > right? If I use just "raise" > > except Exc

Re: Re-raising a RuntimeError - good practice?

2013-10-23 Thread Andrew Berg
On 2013.10.23 22:23, Victor Hooi wrote: > For example: > > def run_all(self): > self.logger.debug('Running loading job for %s' % self.friendly_name) > try: > self.export_to_csv() > self.gzip_csv_file() > self.upload_to_foo() > sel

Re: Beginner's guide to Python

2013-09-04 Thread Andrew Berg
On 2013.09.04 22:39, Dennis Lee Bieber wrote: > On Wed, 04 Sep 2013 07:26:47 +0200, Steve Hayes > declaimed the following: > >>Can anyone recommend a web site that gives a good beginner's guide to Python? >> >>One that tells one, especially -- >> >>-- what kind of projects Python is good for >

Re: How to check client shutdown?

2013-08-27 Thread Andrew Berg
On 2013.08.27 12:44, Paul Pittlerson wrote: > Security issue!? Do you mean someone could enter devious python h4xx into the > chat or something? I had no idea using pickle was so dangerous, but I don't > know any other method of transmitting data in python :( JSON, XML, or any other format that d

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: 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: 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: 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: 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: 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: 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: 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: 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-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-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

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: 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

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: 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: 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: 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: 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: 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: 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: 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: 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: 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: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: 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: 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: 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: 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: 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: 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: 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: 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: 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-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-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 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: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 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 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 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: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

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: Python not starting

2013-05-05 Thread Andrew Berg
On 2013.05.05 13:55, Steven D'Aprano wrote: > (you might need to use /S on Windows instead, I'm not sure.) That is only a convention among Microsoft's CLI utilities. Very few others follow it (even for programs written specifically for Windows), and it is certainly not a necessity on Windows. --

Re: How do I encode and decode this data to write to a file?

2013-04-29 Thread Andrew Berg
On 2013.04.29 04:47, c...@isbd.net wrote: > If I understand correctly the encode() is saying that it can't > understand the data in the html because there's a character 0xc3 in it. > I *think* this means that the é is encoded in UTF-8 already in the > incoming data stream (should be as my system is

Re: TCP reassembly

2013-04-25 Thread Andrew Berg
On 2013.04.25 18:35, Hasil Sharma wrote: > Hi everyone , > How to reassemble the TCP data packets into objects viz. html , css , js > image files etc . I have no idea how to implement it using python , please > help ? TCP packets don't need to be reassembled. If your application receives TCP pa

Re: Ubuntu package "python3" does not include tkinter

2013-04-23 Thread Andrew Berg
On 2013.04.23 00:49, Steven D'Aprano wrote: > Obviously you cannot display an X window without > X, well duh, but merely importing tkinter doesn't require an X display. Importing it doesn't. Doing anything useful with it, however, does. Would you consider the engine an optional part of a car? Af

Re: Ubuntu package "python3" does not include tkinter

2013-04-22 Thread Andrew Berg
On 2013.04.22 19:22, Steven D'Aprano wrote: > It's only when I actually try to do something that requires an X display > that it will fail. I won't show the entire traceback, because it is long > and not particularly enlightening, but the final error message explains > exactly why it isn't worki

Re: Ubuntu package "python3" does not include tkinter

2013-04-22 Thread Andrew Berg
On 2013.04.22 02:17, Steven D'Aprano wrote: > I think that if you are worrying about the overhead of the tkinter > bindings for Python, you're guilty of premature optimization. The tkinter > package in Python 3.3 is trivially small, under 2 MB. > > Besides, how far do we go? Do we expect people

Re: Ubuntu package "python3" does not include tkinter

2013-04-21 Thread Andrew Berg
On 2013.04.21 23:34, rusi wrote: > On Apr 22, 9:24 am, Andrew Berg wrote: >> On 2013.04.21 22:57, Steven D'Aprano wrote:> It's only easy to install a >> package on Ubuntu if you know that you have >> > to, and can somehow work out the name of the package.

Re: Ubuntu package "python3" does not include tkinter

2013-04-21 Thread Andrew Berg
On 2013.04.21 22:57, Steven D'Aprano wrote: > It's only easy to install a package on Ubuntu if you know that you have > to, and can somehow work out the name of the package. I haven't worked with Ubuntu or apt-based packaging in ages, but isn't this kind of information in a description message or

Re: Include and lib files for Visual Studio?

2013-04-20 Thread Andrew Berg
On 2013.04.20 15:59, xuc...@gmail.com wrote: > I am looking for the Python include and lib files for windows. I have a c++ > project that I am importing into Visual Studio 2010 (express) and it links > python. I need the include and lib files for windows. Where can I get them? > I'd like to use p

Re: Ubuntu package "python3" does not include tkinter

2013-04-19 Thread Andrew Berg
On 2013.04.19 12:42, lcrocker wrote: > I understand that for something like a server distribution, but Ubuntu > is a user-focused desktop distribution. It has a GUI, always. That is incorrect. http://www.ubuntu.com/server -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python

Re: Ubuntu package "python3" does not include tkinter

2013-04-19 Thread Andrew Berg
On 2013.04.19 12:17, lcrocker wrote: > Am I mistaken in my belief that tkinter is a non-optional part of the > Python language? I installed the "python3" package on Ubuntu, and > tkinter is not included--it's an optional package "python3-tk" that > has to be installed separately. I reported this as

Re: The node.js Community is Quietly Changing the Face of Open Source

2013-04-16 Thread Andrew Berg
On 2013.04.16 12:14, rusi wrote: > However combine it with your other statement > >> Python's package management is suboptimal (though it is being worked on), > > and a different picture emerges, viz that *the ecosystem around the > language matters more than the language* It was a minor point,

Re: The node.js Community is Quietly Changing the Face of Open Source

2013-04-16 Thread Andrew Berg
On 2013.04.16 11:02, Rodrick Brown wrote: > I came across this article which sums up some of the issues I have with > modern programming languages. I've never really looked at Javascript > for anything serious or Node itself but I found this article really > informational. I don't think the aut

Re: Splitting of string at an interval

2013-04-08 Thread Andrew Berg
On 2013.04.08 21:38, Steven D'Aprano wrote: > In fact, I may make it a bare . so that not only will it be the shortest > program, but also the smallest program in terms of number of non-white > pixels. Until someone implements it in Whitespace. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.

Re: im.py: a python communications tool

2013-04-05 Thread Andrew Berg
On 2013.04.05 20:07, Roy Smith wrote: > I know this is off-topic, but I encourage people to NOT invent their own > licenses. Perhaps he meant this existing license: http://www.wtfpl.net/about/ -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-

Re: I hate you all

2013-04-05 Thread Andrew Berg
On 2013.04.05 19:22, terminato...@gmail.com wrote: > And now python forces me out of using any tab characters at all. I believe I > should still have a choice, python should at lest give an option to set tab > size, if the default of 8 is ambiguous now. Python (at least Python 3) has no concept o

Re: I hate you all

2013-04-05 Thread Andrew Berg
On 2013.04.05 17:04, terminato...@gmail.com wrote: > Line 5 is the only line in the file that starts at col 9 (after a tab). Being > the only line in the file with that indent level, how can it be inconsistent ? The first indent level is done with spaces on the second line (for def) and then with

Re: In defence of 80-char lines

2013-04-03 Thread Andrew Berg
While I agree that not having a line take up hundreds of characters is a good thing, 80 is really arbitrary in 2013 and having any self-imposed hard limit is silly. When you put a single 4- or 5-character word on a new line because you don't want to go over 80 (or 120 or whatever), the code is /les

Re: [Python 2.7.3] What's the difference between these two uses of "for"?

2013-03-17 Thread Andrew Berg
On 2013.03.17 19:58, Yves S. Garret wrote: > N00b question. But here is the code: > > http://bin.cakephp.org/view/709201806 > > In the first example, the first for-loop is run and then the list is assigned > to the tricky variable. But, what > happens in the second example? Does the loop aft

Re: http://stackoverflow.com/questions/15311450/my-chat-client-freezes-up-after-beginning-threads

2013-03-09 Thread Andrew Berg
On 2013.03.09 09:26, Owatch wrote: > Thing is, when I run the program. Nothing happens. > > Can somebody help point out what is wrong? (I've asked questions and > researched for 3 days, without getting anywhere, so I did try) You defined a thread, but never created or started it. Also, why did y

Re: Unhelpful traceback

2013-03-06 Thread Andrew Berg
On 2013.03.07 00:33, John Nagle wrote: > This is wierd, becuase "for fields in reader" isn't directly > doing a decode. That's further down somewhere, and the backtrace > didn't tell me where. Looking at the csv module docs,the reader object iterates over the csvfile argument (which can be any iter

Re: Python script not working on windows 7 but works fine on linux

2013-03-04 Thread Andrew Berg
On 2013.03.04 19:58, Steven D'Aprano wrote: > Windows understands forward slashes in paths too. You can make your code > (almost) platform-independent, and avoid a lot of problems with unescaped > backslashes, by always using forward slashes in paths. Or use os.path.join, the entire purpose of wh

Re: Do you feel bad because of the Python docs?

2013-02-26 Thread Andrew Berg
On 2013.02.26 10:19, notbob wrote: > zsh? What docs!? You mean other than the gigantic user manual? http://zsh.sourceforge.net/Doc/ -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Altering sys.stdin

2013-02-23 Thread Andrew Berg
On 2013.02.23 07:00, Draic Kin wrote: > Intepreter actually freezes when an object without > encoding attribute is assigned to sys.stdin. Why is that? I that a > correct behavior? Is there any workaround to alter input object for > interactive console? If you're going to replace something, the rep

Re: Quick IDE Question

2013-02-17 Thread Andrew Berg
On 2013.02.17 18:38, Claira wrote: > Ok, thanks brilliant people! I can't really keep up with the > conversation about where I should ask since I check my email once a > week, though the quick question I had was that I heard lighttable.com > was an innovative IDE, and since

  1   2   3   4   >