Re: Remote Rsponse Socket Connection
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\x00\x00p2E\xe1+\xe8xG\x00\x00\x01\x08@\x00\x00\x0bmmm\x00\x00\x00\x01(@\x00\x00\x16mmm.xx.com\x00\x00\x00\x00\x01\x0c@\x00\x00\x0c\x00\x00\x07\xd1' > > How is the best way to decode such reply from server? There are generally libraries for dealing with whatever protocol you're using, and they'll be a lot better than something you slap together yourself. If you insist on writing your own thing, then take a look at the documentation for that protocol (for most, this is an RFC). -- https://mail.python.org/mailman/listinfo/python-list
Re: Using + with strings considered bad
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 speed increase') But I was told that using + with strings was bad practice. Is this true? If so, what is the better way to do this? It's not bad practice as such, it's simply that performance takes a nose dive if you're contatenating large numbers of strings. If performance is an issue the recommended way is to write. ' '.join(strings) I thought it was frowned upon because it's less readable for anything non-trivial. hero1 = 'Batman' hero2 = 'Robin' villain = 'The Joker' place = 'Gotham City' sentence = hero1 + and + hero2 + fight + villain + in + place + . # doesn't flow as well as: sentence = {hero1} and {hero2} fight {villain} in {place}..format( hero1=hero1,hero2=hero2,villain=villain,place=place) -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3 lack of support for fcgi/wsgi.
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, it is only used for the deployment of WSGI applications. ... The Web Server Gateway Interface, or WSGI for short, is defined in PEP 333 and is currently the best way to do Python web programming. It seems to me that FastCGI isn't well supported in the Python world because WSGI is by far the recommended choice. -- https://mail.python.org/mailman/listinfo/python-list
Re: Concatenate list values
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: https://docs.python.org/3/tutorial/introduction.html#strings And there is ample reference documentation for strings and lists: https://docs.python.org/3/library/stdtypes.html#string-methods https://docs.python.org/3/library/string.html https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range Get to know strings and lists, and this should be a trivial problem to solve. Or just copy/paste the answers others gave and be confused the next time you need to solve a simple problem. -- https://mail.python.org/mailman/listinfo/python-list
Re: How to wow someone new to Python
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. What do you do? I was thinking along the lines of a simple demo in the REPL, showing off some of Python's coolest features. But then I got stuck on the specifics. What are Python's best coolnesses? What makes for a good demo? Ideally, this should be something that can be demo'd quickly and easily, and it should be impressive without going into great details of and see, this is how it works on the inside. So, how would you brag about this language? If the person is already familiar with programming, you could show off how Python doesn't do a best effort guess at what to do when you make a mistake (explicit is better than implicit). Many other languages will, for example, make an undefined variable into a variable defined as an empty string or allow silly things like 5 + cheese, whereas Python will let you know that you made a mistake somewhere instead of letting garbage propagate. This behavior can be frustrating for newbies to Python, but with someone there to explain why it works that way, they can learn to appreciate it instead of giving up in anger after Python keeps throwing exceptions at them. If the person is not familiar with programming, show them how easy it is to get something useful written quickly, even with only the stdlib. Low-level details are handled so that you can focus on what you want the program to do, and there is a ton of stuff in the stdlib so that it's likely you don't need to go searching for a bunch of different libraries so that again, you can focus what you want the program to do. For this, chances are, that person has some things in mind already that are not difficult to get started with using Python. Also, using the REPL for this makes it an even better demo. You can probably have the basic functionality of whatever cool thing they want right there in the REPL. -- https://mail.python.org/mailman/listinfo/python-list
Re: Function passed as an argument returns none
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 returns what you tell it to (nothing). If you don't explicitly make a function return something, it returns None. Whatever other logic you have in the function is irrelevant. -- https://mail.python.org/mailman/listinfo/python-list
Re: When does True == True
On 2014.08.28 15:38, Seymore4Head wrote: What am I doing wrong? True == True True True == True False type(True) class 'bool' type(True) class 'str' Also, if is already a boolean test, and it is more Pythonic to simply write if pigword.isalpha():. -- https://mail.python.org/mailman/listinfo/python-list
Password strategy [OT] was: PyPI password rules
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 password for the job. My parrot is good at that... uses a dictionary consisting of every word ever noted by her, and can optionally trim it to most common N words for any given value of N. While a vast improvement over the kinds of passwords many places would like to impose, xkcd 936 passwords can still be difficult to remember. I prefer phrases with context (and proper punctuation and capitalization if practical). Something with context is generally easy for a human to remember, but difficult for a machine to guess. keyboard television barf machine or Yay for the download counter! Which one is easier to remember and harder to guess? -- https://mail.python.org/mailman/listinfo/python-list
Re: cmd.exe on WIndows - problem with displaying some Unicode characters
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 program launched from some batch file would have to have the batch file launched from ConEmu, also. Or does ConEmu grab the execution association for batch files to make that work more automatically? When you open a new console, the dialog will ask you to supply a path to an executable you want to run. Any arbitrary CLI application will work. I don't understand your question about batch files. If you mean to ask if ConEmu will snatch a console opened by executing a batch file outside of ConEmu, yes, it can do that. I highly suggest actually using the program and doing some tests of your own to see how it works. ConEmu can use any arbitrary font available on the system. As I have said, I have been able to display Unicode output on it from an application written in Python. No mojibake, no replacement characters, just the exact characters one would expect. I do not know the internals of ConEmu and how it interacts with conhost and whatever else, but I have not found a need to since it has just worked for me. So you may not know the internals of ConEmu, but I presume you know the internals of your Python applications. What encodings do you use for stdout for those applications? Do you set up the Python environment variables that specify some particular encoding, in the ConEmu environment (or does it)? Because the default Python IO encoding in Windows seems to be obtained from the configured code page. I use UTF-8. Open the Python interpreter directly in ConEmu and see what you get. Of course the biggest problem with much free and open source software is the documentation; I wasn't able to find specific answers to all my questions by reading the ConEmu wiki. Maybe some of it would be clearer if I installed it, and your just worked comment is certainly encouraging me to just try it, but while trying it may help me figure it out, adding another package to separately install for my users gives more complexity. See if you can push me over the edge :) It certainly would make things much clearer if you were to actually use the program. Documentation tends to assume (and reasonably so, IMO) that you intend to do some hands-on learning. I can give no advice on deploying this to your users other than to say ConEmu works well as a tool for command line power users on Windows, but does not provide much ROI when it is simply an implementation detail for a single program. If you want to save your users the hassle, I would definitely recommend a graphical environment. If I had realized that you intended your application to be widely deployed, I would have simply recommended that from the start. On a side note, you would have run into similar issues on *nix systems where a significant amount of your users would be using the C locale and have no idea what it is, why it causes them problems, or how to change it. -- https://mail.python.org/mailman/listinfo/python-list
Re: cmd.exe on WIndows - problem with displaying some Unicode characters
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 stuck. That is not quite true. The terminal has these issues, not the shell. Using cp65001 does make Unicode in a Windows terminal possible, but using a better terminal[1] makes it almost perfect (my experience has been that input can be difficult, but output works well). I personally have used an IRC bot written in Python with logging output containing Unicode characters that display just fine (both locally and over SSH). [1] I recommend ConEmu: https://code.google.com/p/conemu-maximus5/ -- https://mail.python.org/mailman/listinfo/python-list
Re: cmd.exe on WIndows - problem with displaying some Unicode characters
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 functionality to the Windows Console interface, it doesn't seem like it is likely to fix bugs or resolve issues with code pages, font selection, or Unicode character repertoires, which are the issues of this thread and the bug I referenced earlier. Can anyone with ConEmu installed refute this interpretation of its functionality? If you run cmd in it, you will still need to use cp65001. This is not necessary for (or applicable to) other applications (such as a Python interpreter) run directly. ConEmu can use any arbitrary font available on the system. As I have said, I have been able to display Unicode output on it from an application written in Python. No mojibake, no replacement characters, just the exact characters one would expect. I do not know the internals of ConEmu and how it interacts with conhost and whatever else, but I have not found a need to since it has just worked for me. -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3.4.1 64 bit Version
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 stdlib. https://docs.python.org/3/library/platform.html -- https://mail.python.org/mailman/listinfo/python-list
Re: OT: usenet reader software
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 only thing it doesn't do that I really want is scoring/kill-files. Tools - Message Filters... -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 3 is killing Python
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). -- https://mail.python.org/mailman/listinfo/python-list
Re: Python alternative to Google Groups
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 web, not just receive email alerts for posting via the web. This list doesn't use Google Groups directly; Google provides an interface to comp.lang.python on Usenet, so something like this would have to be *in addition to* the mailer and Usenet. -- CPython 3.4 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Why Python 3?
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 the times then. Last I checked, only certain parts of it were working on Python 3. Nice to hear that it fully supports Python 3 now. :) -- CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Why Python 3?
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 developing an application, just use Python 3.4 and don't look back unless you absolutely positively *need* one of the big libraries that doesn't fully support Python 3 yet. The smaller ones either support it or have been replaced, and the few remaining (e.g., Twisted, Django) are getting there. Python 2 still exists because there are very large existing projects (some public, some private) that are not able to use Python 3 for some reason (like heavy dependence on a third-party that doesn't support Python 3). If you are developing a new library, the decision is not likely going to be easy, but in general, I'd say the larger it is, the more you should lean toward not having Python 2 support. Of course, there are going to be other factors such as your audience and what, if any, third-party libraries you will need yourself. It's an awkward time to write a new library since supporting both 2 and 3 is a major pain, and Python 2 is eventually going away, but you will still have a significant amount of people who will want to use the library with things that can't support Python 3. Use Python 2 if you must, but know that you will end up needing to migrate to Python 3 eventually. It used to be that support for Python 3 among third-party libraries was small, but that is no longer true: http://python3wos.appspot.com/ -- CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Martijn Faassen: The Call of Python 2.8
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 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 # which python3.4 /usr/local/bin/python3.4 If you really meant that, you would have typed /usr/bin/which2.16 python (or whatever the location and version of which on your system). Are you sure about that? # which which which: shell built-in command Unless I'm forgetting some more explicit way of calling a command built into the shell. -- CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Martijn Faassen: The Call of Python 2.8
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 system which, which is at /usr/bin/which, and which is the which that a shell which does not have a builtin which will use. -- CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Martijn Faassen: The Call of Python 2.8
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/mailman/listinfo/python-list
Re: Martijn Faassen: The Call of Python 2.8
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 # which python3.4 /usr/local/bin/python3.4 -- CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: threading
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). :) -- CPython 3.4.0 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Try-except-finally paradox
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 ... finally: ... print Finally ... return False ... return None ... return_val = paradox() Except after try Finally return_val False I understand most of this. What I don't understand is why this returns False rather than True. Does the finally short-circuit the return in the except block? My guess would be that the interpreter doesn't let the finally block get skipped under any circumstances, so the return value gets set to True, but then it forces the finally block to be run before returning, which changes the return value to False. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Python 2.x and 3.x usage survey
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: https://www.surveymonkey.com/s/N5N5PG2 It was closer to 5 or 10 seconds. :) -- CPython 3.3.3 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: So, what's the real story on Python 2 vs Python 3?
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 package, it shows up as Python 2 unless I explicitly specify Python 3. What's the deal? If I want to make a distributable software package, should it be 2 or 3? Enquiring minds want to know. Oh boy, another 2 vs. 3 thread! Always use 3 unless you absolutely have to use 2. Python 3 is not a shiny new thing. It is *five* years old at this point and is soon to have its *fifth* significant release. Python 2.6 is EOL, and there will not be a 2.8. However, people have stayed with Python 2 for various reasons, and unfortunately, many of those people haven't even made an effort to migrate until the last year or so. Most of the major third-party libraries these days are either 3.x compatible or have 3.x-compatible replacements, though. -- CPython 3.3.3 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Getting the Appdata Directory with Python and PEP?
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 '~/Library//Application Support/'. I can get the OS just fine (sys.platform and then storing it in my own way; example: darwin = OS X, just for my own readability), and I can get the home directory just fine (expanduser), but I have no idea how to get the appdata directory. One way I could think of doing it would be to just detect the os and join the string on like so (completely untested, but an idea); if os == 'OS X': appdata_dir = os.path.join(home_dir, '/Application Support/') But then that arises the problem of cross platform compatibility. So is here a good, cross platform solution to this problem? I don't know about OS X, but on Windows Vista and later, there is os.environ['APPDATA']. I don't explicitly check for OS; instead, I see if APPDATA exists as an environment variable: try: user_data_dir = os.path.join(os.environ['APPDATA'], 'NoiseBot') except KeyError: user_data_dir = os.path.join(os.environ['HOME'], '.NoiseBot') I didn't even know that such a thing existed on OS X. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: How can I get the variable to subtract the input please?
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 and then subtracted from the variable age which is set to 16 and the answer displayed as You have x years left at school. Help much appreciated. Thank you You provided a short code snippet to help describe your problem, which is good, but you omitted what happened and what you expected. You also didn't mention which version of Python you're using (I am going to assume some 3.x; if you are using 2.x, I *strongly* recommend switching to 3.x unless you have a very compelling reason not to). If a traceback is printed, try to make sense of it, and if you can't, post it in its entirety and ask us to explain it. From what I can tell, you are trying to mix integers with strings. Python is strongly typed; it won't try to guess what you want when you try to do things that make no sense for a given type. input() returns a string and you have defined leave as an integer. Using the + operator to concatenate makes sense for strings, but it makes sense to do addition when dealing with number types like integers and floats. If you try to do something silly like add a number to a string, Python will complain because it doesn't know what to do (and again, it won't try to guess). With that in mind, rewrite the code so that you do number operations on numbers and string operations on strings. Hint: there are builtin functions to cast between types. Hint 2: it's a good idea to split up operations to separate lines so that it's easy to see which operation has a problem if there is one. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: grammar (was Re: Automation)
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 pronounce them the same; a lot of such errors are caused by learning incorrect pronunciation. For example, people often write 'should of' because that is what they hear (and what they end up saying). -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: grammar (was Re: Automation)
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://mail.python.org/mailman/listinfo/python-list
Re: Re-raising a RuntimeError - good practice?
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 Exception as err: # catch *everything* logger.error(err) raise that will just re-raise the original exception right? Yes. However, if you are doing logging higher up where you actually handle the exception, then logging here is redundant, and you can simply eliminate the try/catch block completely. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Re-raising a RuntimeError - good practice?
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() self.load_foo_to_bar() except RuntimeError as e: self.logger.error('Error running job %s' % self.friendly_name) ... def export_to_csv(self): ... try: with open(self.export_sql_file, 'r') as f: self.logger.debug('Attempting to read in SQL export statement from %s' % self.export_sql_file) self.export_sql_statement = f.read() self.logger.debug('Successfully read in SQL export statement') except Exception as e: self.logger.error('Error reading in %s - %s' % (self.export_sql_file, e), exc_info=True) raise RuntimeError You're not re-raising a RuntimeError. You're swallowing all exceptions and then raising a RuntimeError. Re-raise the original exception in export_to_csv() and then handle it higher up. As Steven suggested, it is a good idea to handle exceptions in as few places as possible (and as specifically as possible). Also, loggers have an exception method, which can be very helpful in debugging when unexpected things happen, especially when you need to catch a wide range of exceptions. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 10.0 -- https://mail.python.org/mailman/listinfo/python-list
Re: Beginner's guide to Python
On 2013.09.04 22:39, Dennis Lee Bieber wrote: On Wed, 04 Sep 2013 07:26:47 +0200, Steve Hayes hayes...@telkomsa.net 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 So far as I know, Python is Turing-complete -- it can be used for anything... So is Brainfuck, but I wouldn't say it's good for *any* project... -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.2 -- https://mail.python.org/mailman/listinfo/python-list
Re: How to check client shutdown?
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 doesn't have the capacity to serialize directly executable Python code. Pickles are okay for internal data from trusted sources, but don't accept pickles from anyone you don't trust. JSON is simple, easy, and can handle the common data types, and there is a module for it in the stdlib. It's also a standard format you can use in pretty much any language, and it's human readable. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)
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 should I stick with Python 2 to get a taste of what is currently out there? Python 2 is what some people are stuck with because their projects depend on huge libraries that have not yet made all their code compatible with Python 3 (or on libraries that are not actively maintained or are being replaced by something else). All new code and new Python users should be using Python 3 unless there is a pressing need for a library that requires Python 2. Most popular libraries at this point have either been made compatible or have been replaced by something that supports Python 3. Python 3 is no longer the shiny new thing to look at in the future - 3.0 was released in December 2008. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Help with 'self' and 'set_usage'
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 you gave, that is where usage_str is defined. You simply assign an object to a name or attribute (which may or may not have existed previously). You can then change it to anything else you want; Python is dynamically typed, so the object you assign to it can be of any type. Note: a class with __slots__ defined is the exception to this, but that's a bit of an advanced topic. BTW, you can play with objects in the interactive interpreter. It's a great way to quickly learn how certain things work. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]
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 PowerShell.exe –ExecutionPolicy Bypass –File c:\temp\bad-script.ps1 not a security bug? Ultimately, if bad code has the ability to run this code, it already has control of the machine. http://blogs.msdn.com/b/powershell/archive/2008/09/30/powershell-s-security-guiding-principles.aspx If an attacker can run code, he/she already has the capability to well, run code. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]
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 Window or something. I mention this because it seems to get called out every time someone uses the term DOS on this and other Python lists and it can smack slightly of pedantry. It's not as ambiguous (or as common) as it used to be, but it has always bothered me when someone refers to the Win32 console as DOS. I try not to be rude about it, but I really would like to prevent those who are not very familiar with Windows or its history from associating the limits and internal behavior of MS-DOS with the console subsystem of Windows NT. Especially with the anti-Windows sentiment that seems to be getting more popular (not that it's entirely without merit, but that's another topic for another day on another list), I'd rather see operating systems judged on things that are actually true and not miscellaneous FUD spread by ignorance and confusion. I realize it can come off as pedantic, but what may be obvious to those with of us with a lot of experience with different operating systems over the years can easily slip past a novice. BTW, there are several short and unambiguous terms one can use to refer to the Windows CLI environment (or parts thereof): cmd, command prompt, command line, terminal, console, etc.. Also, I don't think I've ever encountered anyone who prefers to call it DOS even though they know it's not correct, but if you say it's not unusual, then they're obviously out there, and I'll keep that in mind before jumping in to correct them. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: How to tell Script to use pythonw.exe ?
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 is long dead, and is much, much different under the hood from the console subsystem in modern versions of Windows. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: python adds an extra half space when reading from a string or list
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-list. Most on this list do not consider insults and flaming on the list acceptable. It doesn't matter who started it. I use Thunderbird and i'm currently looking for a way to kill-file him, because he is not likely to stop. Tools - Message Filters... -- 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
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? This behavior is fixed in Python 3: max('10', 10) Traceback (most recent call last): File stdin, line 1, in module TypeError: unorderable types: int() str() Python is strongly typed, so it shouldn't magically convert something from one type to another. Explicit is better than implicit. -- 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?
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?
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 module to make it do what I want, and I would really rather not try to shoehorn one paradigm into another. Unfortunately, getopt provides none of the benefits I sought with argparse, and optparse is deprecated, so I will probably be rolling my own custom parser. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Why is the argparse module so inflexible?
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 can handle it. Overriding ArgumentParser.error doesn't really help since methods like parse_known_args just send a message to be relayed to the user as an argument after swallowing ArgumentError (which does have useful information in its attributes). If I wanted to figure out what actually caused the exception to be raised, I'd have to parse the message, which is ugly at best. I understand that most people do want argparse to just display a message and terminate if the arguments supplied aren't useful, but there's a lot of potential in the module that is crippled outside the main use case. I have to wonder why a module that is meant to be imported would ever call sys.exit(), even if that is what the caller would normally do if presented with an exception. -- 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?
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 precmd hook for a cmd.Cmd child class. argparse's help system is more sophisticated than cmd's help and does all the work of verifying arguments. The problem I keep running into is that I can't handle any bad input very well. I would have to override every method that catches ArgumentError in order to get a useful exception that I would then handle. If I input something that begins with '-' that isn't recognized, parse_args doesn't even raise the exception; it just quits. In this case, the message gets mangled if error is overridden, and I don't know why. You might look into type=. It's normally used for things like type=int or type=float, but it could give it any user-defined function as a type and this essentially becomes a hook to insert your own code into the middle of the processing. Sometimes that can be warped into doing all sorts of useful things. I don't think that would solve my problem, but it would probably be quite useful. -- 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?
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://bugs.python.org/issue9938 -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
[issue9938] Documentation for argparse interactive use
Andrew Berg added the comment: What is the status of this? If the patch looks good, then will it be pushed into 3.4? -- nosy: +aberg ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9938 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9938] Documentation for argparse interactive use
Andrew Berg added the comment: The patch doesn't work for 3.3 (I think it's just because the line numbers are different), but looking over what the patch does, it looks like parse_known_args will return a value for args if there is an unrecognized argument, which will cause parse_args to call error() (it should raise ArgumentError instead). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9938 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
Re: newbie EOL while scanning string literal
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 errors are often the result of typos; IDEs can easily detect such problems and will highlight them for you to make them obvious. int(naa) Strings are immutable; this returns an integer, but you don't assign it to anything. is_triangle(na,ne,ni) And here, you pass the strings you assigned for the input prompt instead of the integers you wanted to get. BTW, if you have an error, it helps if you copy/paste the full traceback. Many times, the exact issue is laid out in the traceback, and the solution is obvious to those with experience. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: A few questiosn about encoding
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 (therefore DEMANDING 3 dimensions) and glyphs derived from Unicode are restrictively two dimensional, because let's face it people, Unicode exists in your computer, and computer screens are two dimensional... but you already knew that -- i think?, then what is the purpose of a Unicode Braille character set? Two dimensional characters can be made into 3 dimensional shapes. Building numbers are a good example of this. We already have one Unicode troll; do we really need you too? -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: My son wants me to teach him Python
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 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Re-using copyrighted code
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 reading? The exact license terms. We might be able to help if you tell us which part(s) of the license you don't understand. There are some nice articles on many of the more common licenses on Wikipedia as well if you want a broader understanding. Open-source only implies that the source code is available. What one is allowed to actually do with the code will vary by project/author. Now, how am I supposed to deal with that? Ask Secret Labs for some kind of permission? Leave it as it is and add my own copyright line? If you can't find the license, I'd suggest sending an email to that address asking for a copy. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Re-using copyrighted code
On 2013.06.08 17:09, Benjamin Kaplan wrote: On Sat, Jun 8, 2013 at 2:31 PM, Malte Forkel malte.for...@berlin.de 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 engine have been developed in cooperation with # CNRI. Hewlett-Packard provided funding for 1.6 integration and # other compatibility work. # Now, how am I supposed to deal with that? Ask Secret Labs for some kind of permission? Leave it as it is and add my own copyright line? Malte You can find the license terms for all versions of Python at http://docs.python.org/3/license.html I'm not a lawyer, but it looks like you just need to include the copyright statement. I misread that bit, having forgotten that Python was not always under the PSF. To the OP: this is a pretty permissive license, but, as noted in the FAQ that Chris linked, there could be a problem if you wish to license your work under the GPL since the CNRI license specifies a jurisdiction. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: PyWart: The problem with print
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 messages to files too in case we need to reference them again. The messages should have a consistent format as well. Why add the same information to each message when it would be much simpler to simply define a default format and insert the real meat of the message into it? It really seems like we should already have something like this. Hmm. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: I want to know how to implement concurrent threads in Python
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 on something specific. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: I want to know how to implement concurrent threads in Python
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: Prepending string @ to usernames
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 -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing Json data (I think I am nearly there) complete beginner
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 trying to get values from text1? Are there gremlins going around flipping bits in memory? It's good that you posted code, but really cant get anything out of this isn't very useful. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing Json data (I think I am nearly there) complete beginner
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'] that isnt working. If fed a valid JSON object, json.loads() will return a regular dictionary. You can print (or pretty print with the pprint module) text1 to see everything. If you're not familiar with dictionaries and lists, thoroughly read the tutorial before writing or modifying any more code. http://docs.python.org/2/library/json.html#json.loads -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Accessing Json data (I think I am nearly there) complete beginner
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 for standardized formats like JSON. They can be very useful when nothing saner will get the job done, but are a nasty mess with no real benefit otherwise. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: How to raise a socket 104 connection reset by peer error
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 got its own builtin exception: http://docs.python.org/3.3/tutorial/errors.html#raising-exceptions http://docs.python.org/3.3/library/exceptions.html#ConnectionResetError In earlier versions of Python, you will have to raise OSError and set its errno attribute. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 378: Format Specifier for Thousands Separator
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 interpolation using the modulo operator has lost favor to the string object's format method. Please stop perpetuating this myth, see http://mail.python.org/pipermail/python-dev/2012-February/116789.html and http://bugs.python.org/issue14123 What myth? People should indeed be using .format(), but no one said % formatting was going away soon. Also, the suggested change to the docs wasn't made and the issue is closed. The current docs do not say that % formatting isn't going to be deprecated, but it does mention its caveats and suggests .format(). If you are trying to say that % formatting will never ever go away, then you are wrong. It is highly unlikely to go away in a 3.x release, but /may/ get phased out in Python 4.0. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: PEP 378: Format Specifier for Thousands Separator
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/2012-February/116789.html and http://bugs.python.org/issue14123 What myth? The myth that % string formatting is deprecated. It is not deprecated. Skip didn't say that it was deprecated. but no one said % formatting was going away soon. True, but only for the definition no one = all the people who insist that % is deprecated, or soon to be deprecated. Perhaps I missed something, but who is insisting this? What happens in Python 4000 is irrelevant. If somebody is trying to future proof their code for a version that *may never exist*, and if it does exist is likely to be six or eight years away from even starting the design phase, they are wasting their time. It is hard enough to track a moving target, it is impossible to track a target that isn't even a gleam in GvR's eye yet. I think you misunderstand. I'm not suggesting that format() be used simply because % formatting could be deprecated at some unknown time years from now; I was clarifying the status of % formatting. -- CPython 3.3.2 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for philosophers
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=crIJvcWkVcs -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: executing python scripts that are symlinked
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 put a symlink from H/script to WC, it doesn't find the packages that are in WC. Also, if I use the absolute path to H, it won't find them, but I guess I can understand that. Symlinks can find their targets, but targets have absolutely no way of knowing where symlinks to them are. It's one-way. It would work if the actual file were in WC and you created a symlink inside H. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: python sockets question
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 heterogeneous systems. I can use Python on Windows to create a client that will connect to a service written in C running on Solaris or to something written in Java running on Linux. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Differences of != operator behavior in python3 and python2 [ bug? ]
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 help, copyright, credits or license for more information. from __future__ import barry_as_FLUFL 3 2 True -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 are used mainly for organization but a nice benefit of tags is that they are not subject to file system or URL or whatever other limits. If an audio file has no metadata, most players will show the file name. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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. Likewise for Ke$ha, Beyonce, and I don't even want to think about the artist formerly known as an unpronounceable glyph. Pro-tip, guys. If you want to form a band, and expect people to be able to find your stuff in a search engine some day, don't play cute with your name. It's a thing (especially in witch house) to make names with odd glyphs in order to be harder to find and be more underground. Very silly. Try doing searches for these artists with names like these: http://www.last.fm/music/%E2%96%BC%E2%96%A1%E2%96%A0%E2%96%A1%E2%96%A0%E2%96%A1%E2%96%A0 http://www.last.fm/music/ki%E2%80%A0%E2%80%A0y+c%E2%96%B2t -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Making safe file names
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 strategies for naming such files while avoiding conflicts (I wouldn't want to run into problems for an artist named C-A-T or CAT, for example)? I'd like to make the files easily identifiable, and there really are no limits on what characters can be in an artist name. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 just use IDs from the database? None of these would work because I would have no idea which file stores data for which artist without writing code to figure it out. If I were to end up writing a bug that messed up a few of my cache files and noticed it with a specific artist (e.g., doing a now playing and seeing the wrong tags), I would either have to manually match up the hash or base64 encoding in order to delete just that file so that it gets regenerated or nuke and regenerate my entire cache. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 the details.) It is possible that one of the functions would work for you as is, or with little modification. This has the problem of mangling non-ASCII characters (and artist names with non-ASCII characters are not rare). I most definitely want to keep as many characters untouched as possible so that the files are easy to identify by looking at the file name. Ideally, only characters that file systems don't like would be transformed. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 two-way mapping (isomorphic if I remember my math-lear- nining days correctly) between the original name and the way you store it. E.g. C/A/T would become C%2FA%2FT and C%2FA/T would become C%252FA%2FT You can translate back and forth between them with not too much effort. Of course, that assumes that '%' is a character allowed by your file system - otherwise pick some other one, any one will do in principle. It's a bit harder for a human to in- terpret but rathe likely not that much of a problem. Yes, something like this is what I am trying to achieve. Judging by the responses I've gotten so far, I think I'll have to roll my own transformation scheme since URL encoding and the like transform Unicode characters. I can memorize that 植松伸夫 is a Japanese composer who is well-known for his works in the Final Fantasy series of video games. Trying to match up the URL-encoded version to an artist would be almost impossible when I have several other artist names that have no ASCII characters. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 to be mostly portable. Characters outside whatever sys.getfilesystemencoding() returns won't be allowed. If the user's locale settings don't support Unicode, my program will be far from the only one to have issues with it. Any problem reports that arise from a user moving between legacy encodings will generally be ignored. I haven't yet decided how I will handle artist names with characters outside UTF-8, but inside UTF-16/32 (UTF-16 is just fine on Windows/NTFS, but on Unix(-ish) systems, many use UTF-8 in their locale settings). Don't forget that ls and rm may not use the same encoding you're using. So you may not consider it adequate to make the names legal, but you may also want they easily typeable in the shell. I don't understand. I have no intention of changing Unicode characters. This is not a Unicode issue since (modern) file systems will happily accept it. The issue is that certain characters (which are ASCII) are not allowed on some file systems: \ / : * ?| @ and the NUL character The first 9 are not allowed on NTFS, the @ is not allowed on ext3cow, and NUL and / are not allowed on pretty much any file system. Locale settings and encodings aside, these 11 characters will need to be escaped. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 the case of the artist name as necessary, though. For example, if Sam becomes SAM again (I have seen Last.fm change the case for artist names), I need to make sure that I don't end up with two file names differing only in case. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 of the filenames being anything more than a rare occurrence, but I will occasionally just read the list. What about viewing 0x07 in the terminal window? Or 0x04? I don't think Last.fm will even send those characters. In any case, control characters in artist names are rare enough that it's not worth the trouble to write the code to avoid the problems associated with them. As soon as you have a small, finite list of invalid characters, writing an escape system is pretty easy. Probably. I was just hoping there was an existing system that would work, but as I said in a different reply, it would seem I need to roll my own. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Making safe file names
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 characters. Of course you do. You even talk below about Unicode characters like * and ? not being allowed on NTFS systems. I worded that incorrectly. What I meant, of course, is that I intend to preserve as many characters as possible and have no need to stay within ASCII. If you have an artist with control characters in their name, like newline or carriage return or NUL, I think it is fair to just drop the control characters and then give the artist a thorough thrashing with a halibut. While the thrashing with a halibut may be warranted (though I personally would use a rubber chicken), conflicts are problematic. Does your mapping really need to be guaranteed reversible? If you have an artist called JoeBlow, and another artist called Joe\0Blow, and a third called Joe\nBlow, does it *really* matter if your application conflates them? Yes and yes. Some artists like to be real cute with their names and make witch house artist names look tame in comparison, and some may choose to use names similar to some very popular artists. I've also seen people scrobble fake artists with names that look like real artist names (using things like a non-breaking space instead of a regular space) with different artist pictures in order to confuse and troll people. If I could remember the user profiles with this, I'd link them. Last.fm is a silly place. As I said before though, I don't think control characters are even allowed in artist names (likely for technical reasons). -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python not starting
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. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: How do I encode and decode this data to write to a file?
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 wholly UTF-8 as far as I know and I created the directory name). You can verify that your filesystem is set to use UTF-8 with sys.getfilesystemencoding(). If it returns 'ascii', then your locale settings are incorrect. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: TCP reassembly
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 packets out of order, there is a problem with your networking equipment (or possibly the TCP stack in your OS). I suspect that you actually mean that you want distinct bytes objects that represent specific data. Sockets will give you a stream of bytes; how the data is separated is defined by the protocol. If you are dealing with HTTP, it is much better to use an HTTP client library than raw sockets. In fact, there are many libraries available for many different protocols, which are a better choice than dealing with sockets directly for all but the simplest protocols. You'll get a better answer if you tell us what the problem is and what you are trying to accomplish. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ubuntu package python3 does not include tkinter
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? After all, the radio would still work and you can put things in the glove compartment. We just disagree on where to break the packages up. We disagree on what a dependency is. I say a dependency is something required in order to have any functionality that is not defined as optional or extra by the author(s). You say it's anything required in order to initialize, even if there is little to no actual functionality. Perhaps you are fond of hunting down components to make something work, but most people would expect a packaging system to automatically install whatever is required to make the software they want to use do what it is supposed to. Or perhaps you had a dummy package in mind that would automatically pull in Tcl/Tk and X and whatever else is required to make tkinter draw things on a screen as a convenience. Of course, that brings us back to the OP's problem... Since Linux distros already include whatever third-party software they see fit as part of their base (or have the OS installer install whatever the user specifies during installation), why not have desktop configurations include tkinter by default when installing? -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ubuntu package python3 does not include tkinter
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 to install (say): python3-copy so that those who don't need the copy module don't have to install it? Much of the stdlib doesn't rely on anything but the core interpreter. tkinter by itself is not the issue. As you said, the bindings are tiny. However, in order to be usable, it requires quite a few things - most notably X. On desktop Linux, this is already installed, but on server systems, it generally is not (or at least shouldn't be in most cases). Going back to my example of a web server using a Python-based framework, I'll repeat that there is no reason such a system should have X even installed in order to serve web pages. Even on a lean, mean server machine, CPython requires only a few extra libraries. Add tkinter, and suddenly you have to install a LOT of things. If you plan to actually use tkinter, this is fine. If not, you've just added a lot of stuff that you don't need. This adds unnecessary overhead in several places (like your package system's database). -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ubuntu package python3 does not include tkinter
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 working: _tkinter.TclError: no display name and no $DISPLAY environment variable So you want to go from this won't work because it's not installed to this won't work, and it there could be a hundred different reasons why? tkinter's main function is to display something on a display. To say that displaying something is an optional feature is absurd. You can install this, but your package manager won't pull in any dependencies because a few minor things will work without them. If you want it to actually do what it was made for, you need to install them yourself. Much bigger problem than the OP's, no? -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ubuntu package python3 does not include tkinter
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 something (especially in a GUI frontend)? -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ubuntu package python3 does not include tkinter
On 2013.04.21 23:34, rusi wrote: On Apr 22, 9:24 am, Andrew Berg bahamutzero8...@gmail.com 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. I haven't worked with Ubuntu or apt-based packaging in ages, but isn't this kind of information in a description message or something (especially in a GUI frontend)? Of course... If you know where to look. (I think that's Steven's point in the 'you know that you have to') I meant when installing it. I forgot for a moment that Ubuntu and many other Linux distros come with Python already installed. -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Include and lib files for Visual Studio?
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 python 3.3.1 if possible. Are they not in the source tarballs or VS debug info files archives on the 3.3.1 download page? -- CPython 3.3.1 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ubuntu package python3 does not include tkinter
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 a bug as was summarily slapped down. Forcing Tkinter as a dependency would result in a ton of things being installed to support it. Why should a web server using Django have X installed and running because Python /can/ support a GUI in the standard library? It's trivial to install Tkinter if you need it, but it would be a huge mess to try to remove it from an installation that requires it - even if you never use Tkinter. Ubuntu is far from alone here. FreeBSD (and probably the other BSDs) and most Linux distros do something similar. There is zero reason to force Tkinter and its dependencies on all Python users. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Ubuntu package python3 does not include tkinter
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.org/mailman/listinfo/python-list
Re: The node.js Community is Quietly Changing the Face of Open Source
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 author really knows Python. I am not familiar with node.js, but I do know that it is not Python. Python's package management is suboptimal (though it is being worked on), but the main reason to have no dependencies is that Python changes. Guess how many people are using Python 3 (which was released over 4 years ago) and how many people are still using Python 2. The standard library just works on the latest version, no matter how much changes - it /has/ to. I find it somewhat amusing that he says that the standard library discourages better tools to compete with the standard library right after mentioning requests, which is... a better tool to compete with the standard library. The idea that developers will rarely ever compete against the standard library is absurd - we have not only requests to compete with the HTTP libraries, but also Twisted and greenlet and Stackless to compete with the async libraries. It's also just plain dumb to have a bunch of libraries doing the same thing. If the standard library isn't doing a good job, something will compete with it. If it is doing a good job, there is no reason to write a library to do the same thing. With third-party libraries everywhere, there can easily be duplicate functionality where there doesn't need to be (there could be silly bikeshed issues or perhaps one developer simply doesn't know about the other project). While the process can be slow, the standard library will change. In fact, 3.4 is going to have a new async I/O library because asyncore and asynchat are just not good enough - after all, that's why projects like Twisted started. Perhaps having a minimal core works well for node.js, but Python is much, much better off having its batteries included. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: The node.js Community is Quietly Changing the Face of Open Source
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, and while I think the ecosystem is important, I am not arguing that it is more important than the language itself. This discussion has much to do with ecosystems and little to do with languages, so I'm not sure what your point is here. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Splitting of string at an interval
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.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: I hate you all
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 a tab on the third (and another tab to indent again). Remember that your for loop is inside the class definition. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: I hate you all
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 of tab size. A tab is one character, and how an editor or terminal or whatever chooses to display it has nothing to do with Python. If you want to convert tabs to a specific number of spaces or vice versa, there are multiple tools out there you can use. In fact, many editors have the functionality built in. Use all tabs or use all spaces. Any editor that isn't broken will let you do either without problems. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: im.py: a python communications tool
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-list
Re: In defence of 80-char lines
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 /less/ readable. A better guideline is to make new lines as necessary to make things more readable rather than blindly stick to some hard limit and say it's more readable just because. Also, IMO, 80 is far too limiting and I find 120-130 much better. Then again, I like small font sizes and avoid lower resolution screens like the plague. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: [Python 2.7.3] What's the difference between these two uses of for?
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 after in get run only once or multiple number of times? In the first example, sorted() returns a list, which is assigned to the name tricky (Python doesn't have variables - names simply point to objects in memory), and then the for loop iterates over tricky, which points to a list. In the second example, the for loop iterates over the list that sorted() returns. The only difference between the two is that the list that sorted() returns is assigned to a name in the first example. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: http://stackoverflow.com/questions/15311450/my-chat-client-freezes-up-after-beginning-threads
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 you subclass threading.Thread? You also mentioned queues, but you didn't use them. Not tested, but shows the basics: import threading import queue import socket def process(): while alive: thing = things_to_process.get() # do stuff with the thing here things_to_process.task_done() alive = True host = 'localhost' port = things_to_process = queue.Queue() process_thread = threading.Thread(target=process) process_thread.start() sock = socket.socket() sock.connect((host, port)) while alive: try: data = sock.recv() except Exception: # should probably do different things for different errors in real code alive = False sock.close() process_thread.join() raise else: things_to_process.put(data) -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Unhelpful traceback
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 iterator). I think that, in the case of a file object, it's not decoded until iteration. I've never used the csv module before though, so I could be wrong. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Python script not working on windows 7 but works fine on linux
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 which is to create suitable paths dynamically. -- CPython 3.3.0 | Windows NT 6.2.9200 / FreeBSD 9.1 -- http://mail.python.org/mailman/listinfo/python-list
Re: Do you feel bad because of the Python docs?
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