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 Steven D'Aprano
On Wed, 08 May 2013 00:13:20 -0400, Dave Angel wrote: > On 05/07/2013 11:40 PM, Steven D'Aprano wrote: >> >> >> >> These are all Unicode characters too. Unicode is a subset of ASCII, so >> anything which is ASCII is also Unicode. >> >> >> > Typo. You meant Unicode is a superset of ASCII. Da

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 11:40 PM, Steven D'Aprano wrote: These are all Unicode characters too. Unicode is a subset of ASCII, so anything which is ASCII is also Unicode. Typo. You meant Unicode is a superset of ASCII. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 10:06 PM, Andrew Berg wrote: 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

Re: Making safe file names

2013-05-07 Thread Steven D'Aprano
On Tue, 07 May 2013 19:51:24 -0500, Andrew Berg wrote: > 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

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Steven D'Aprano
On Tue, 07 May 2013 15:17:52 +0100, Steve Simmons wrote: > Good to see jmf finally comparing apples with apples :-) *groans* Truly the terrible pun that the terrible hijacking deserves. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple versions of python

2013-05-07 Thread Mark Lawrence
On 08/05/2013 02:35, Colin J. Williams wrote: On 07/05/2013 6:26 PM, sokovic.anamar...@gmail.com wrote: Hi, what is the generally recommended structure when we have into play this type of problem: multiple versions of python (both in the sense of main versions and sub versions, e.g., 2.7 :

Re: Making safe file names

2013-05-07 Thread Roy Smith
In article , 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. OSX, too. -- http://mail.python.org/mailman/listinfo/python-list

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 Dave Angel
On 05/07/2013 09:28 PM, Neil Hodgson wrote: Andrew Berg: 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

Re: multiple versions of python

2013-05-07 Thread Roy Smith
In article , "Colin J. Williams" wrote: > Do you really need more than 2.7.3 and 3.3.1. It's often useful to have older versions around, so you can test your code against them. Lots of projects try to stay compatible with older releases. -- http://mail.python.org/mailman/listinfo/python-li

Re: multiple versions of python

2013-05-07 Thread Colin J. Williams
On 07/05/2013 6:26 PM, sokovic.anamar...@gmail.com wrote: Hi, what is the generally recommended structure when we have into play this type of problem: multiple versions of python (both in the sense of main versions and sub versions, e.g., 2.7 : 2.7.1 2.7.3 3: 3.3 3.3.1 Different

Re: Making safe file names

2013-05-07 Thread Neil Hodgson
Andrew Berg: 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 ext

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Mark Lawrence
On 08/05/2013 01:34, Neil Hodgson wrote: jmfauth: 2) More critical, Py 3.3, just becomes non unicode compliant, (eg European languages or "ascii" typographers !) ... This is not demonstrating non-compliance. It is comparing performance, not compliance. Please show an example where Py

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Dave Angel
On 05/07/2013 09:11 PM, Benjamin Kaplan wrote: On May 7, 2013 5:42 PM, "Neil Hodgson" wrote: jmfauth: 2) More critical, Py 3.3, just becomes non unicode compliant, (eg European languages or "ascii" typographers !) ... This is not demonstrating non-compliance. It is comparing performan

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Benjamin Kaplan
On May 7, 2013 5:42 PM, "Neil Hodgson" wrote: > > jmfauth: > >> 2) More critical, Py 3.3, just becomes non unicode compliant, >> (eg European languages or "ascii" typographers !) >> ... > > >This is not demonstrating non-compliance. It is comparing performance, not compliance. > >Please sh

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 08:51 PM, Andrew Berg wrote: 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 b

Re: distributing a binary package

2013-05-07 Thread Miki Tebeka
> I already have the .so files compiled. http://docs.python.org/2/distutils/setupscript.html#installing-package-data ? -- http://mail.python.org/mailman/listinfo/python-list

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: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Neil Hodgson
jmfauth: 2) More critical, Py 3.3, just becomes non unicode compliant, (eg European languages or "ascii" typographers !) ... This is not demonstrating non-compliance. It is comparing performance, not compliance. Please show an example where Python 3.3 is not compliant with Unicode.

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 Roy Smith
In article , Dave Angel wrote: > On 05/07/2013 03:58 PM, Andrew Berg wrote: > > 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

Re: Making safe file names

2013-05-07 Thread Dave Angel
On 05/07/2013 03:58 PM, Andrew Berg wrote: 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 forwar

Re: multiple versions of python

2013-05-07 Thread Roy Smith
In article <72f93710-9812-441e-8d3d-f221d5698...@googlegroups.com>, sokovic.anamar...@gmail.com wrote: > Hi, > > what is the generally recommended structure when we have into play this type > of problem: > multiple versions of python (both in the sense of main versions and sub > versions, e.g.

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

Re: Making safe file names

2013-05-07 Thread Chris Angelico
On Wed, May 8, 2013 at 8:18 AM, 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. But it doesn't look anything li

Re: Making safe file names

2013-05-07 Thread Jens Thoms Toerring
Andrew Berg wrote: > 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 the

multiple versions of python

2013-05-07 Thread sokovic . anamarija
Hi, what is the generally recommended structure when we have into play this type of problem: multiple versions of python (both in the sense of main versions and sub versions, e.g., 2.7 : 2.7.1 2.7.3 3: 3.3 3.3.1 Different versions of gcc different compilation strategies (-vanilla and

Re: Making safe file names

2013-05-07 Thread Dan Stromberg
On 5/7/13, Andrew Berg wrote: > 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 slashe

Re: Making safe file names

2013-05-07 Thread MRAB
On 07/05/2013 20:58, Andrew Berg wrote: 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 s

Re: Making safe file names

2013-05-07 Thread Fábio Santos
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? On Tue, May 7, 2013

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread William Ray Wing
On May 7, 2013, at 4:31 PM, Martijn Lievaart wrote: > On Sun, 05 May 2013 17:07:41 -0400, Roy Smith wrote: > >> There *are* programming languages worse than PHP. Have you ever tried >> britescript? > > Have you tried MUMPS? :-) > > M4 > Which one? The original MUMPS (Massachusetts General

Re: Making safe file names

2013-05-07 Thread Terry Jan Reedy
On 5/7/2013 3:58 PM, Andrew Berg wrote: 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 s

Re: Get filename using filefialog.askfilename

2013-05-07 Thread Terry Jan Reedy
On 5/7/2013 4:27 PM, cheirasa...@gmail.com wrote: file = filedialog.askopenfile ( mode... ) askopenfile is a convenience function that creates an Open dialog object, shows it, gets the name returned by the dialog, opens the file with that name, and returns an appropriate normal file obje

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Walter Hurry
On Tue, 07 May 2013 23:32:55 +1000, Chris Angelico wrote: > On Tue, May 7, 2013 at 11:22 PM, jmfauth wrote: >> There are plenty of good reasons to use Python. There are also plenty >> of good reasons to not use (or now to drop) Python and to realize that >> if you wish to process text seriously,

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread 88888 Dihedral
Chris Angelico於 2013年5月7日星期二UTC+8下午9時32分55秒寫道: > On Tue, May 7, 2013 at 11:22 PM, jmfauth wrote: > > > There are plenty of good reasons to use Python. There are > > > also plenty of good reasons to not use (or now to drop) > > > Python and to realize that if you wish to process text > > > seri

Re: Get filename using filefialog.askfilename

2013-05-07 Thread John Gordon
In cheirasa...@gmail.com writes: > print(file) > the output is: <..name="file.doc"...mode=..encoding.. > > How can i get the second member of 'file'? If you're using the interpreter, you can type this command: >>> help(file) And it will display documentation for using o

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Martijn Lievaart
On Sun, 05 May 2013 17:07:41 -0400, Roy Smith wrote: > There *are* programming languages worse than PHP. Have you ever tried > britescript? Have you tried MUMPS? :-) M4 -- http://mail.python.org/mailman/listinfo/python-list

Get filename using filefialog.askfilename

2013-05-07 Thread cheirasacan
Well. It's driving me crazy. So simple I use: file = filedialog.askopenfile ( mode... ) to open a file with an open dialog box, OK. Made it. How i get the name of the opened file? i do : print(file) the output is: <..name="file.doc"...mode=..encoding.. > How can i g

Re: Why sfml does not play the file inside a function in this python code?

2013-05-07 Thread cheirasacan
El martes, 7 de mayo de 2013 16:57:59 UTC+2, MRAB escribió: > On 07/05/2013 14:56, cheirasa...@gmail.com wrote: > > > El martes, 7 de mayo de 2013 12:53:25 UTC+2, MRAB escribió: > > >> On 07/05/2013 10:27, cheirasa...@gmail.com wrote: > > >> > from tkinter import * > > >> > import sfml > > >

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 backup script

2013-05-07 Thread Enrico 'Henryx' Bianchi
John Gordon wrote: > Looks like you need a comma after 'stdout=filename'. Sigh, yesterday was a terrible day (yes, it lacks a comma)... Anyway, when it is possible, is recommended to use the drivers for communicate with databases, because subprocess (or os.*open*) is more expensive compared to

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Terry Jan Reedy
On 5/7/2013 9:22 AM, jmfauth road forth on his dead hobbyhorse to hijack yet another thread: # Py 3.3 ascii and non ascii chars timeit.repeat("a = 'hundred'; 'x' in a") [0.11426985953005442, 0.10040049292649655, 0.09920834808588097] timeit.repeat("a = 'maçãé€ẞ'; 'é' in a") [0.23455951882567

dist-packages or site-packages in Python 3.2 ?

2013-05-07 Thread Vincent Vande Vyvre
Hi, I've one machine with python3.2 (on Ubuntu 12.04), in the folder /usr/lib/python3.2 it is a subfolder dist-packages, maybe created at the install or created when I've installed the binding pyexiv2, I don't know. Now, I've installed a new machine, again with Ubuntu 12.04 and therefore pyt

Re: Why sfml does not play the file inside a function in this python code?

2013-05-07 Thread Chris Angelico
On Wed, May 8, 2013 at 12:57 AM, MRAB wrote: > Also, please read this: > > http://wiki.python.org/moin/GoogleGroupsPython > > because gmail insists on adding extra linebreaks, which can be somewhat > annoying. Accuracy correction: It's nothing to do with gmail, which is what I use (via python-lis

Re: Why sfml does not play the file inside a function in this python code?

2013-05-07 Thread MRAB
On 07/05/2013 14:56, cheirasa...@gmail.com wrote: El martes, 7 de mayo de 2013 12:53:25 UTC+2, MRAB escribió: On 07/05/2013 10:27, cheirasa...@gmail.com wrote: > from tkinter import * > import sfml > > window = Tk() > window.minsize( 640, 480 ) > > def sonido(): > file = sfml.Music.from_fi

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Steve Simmons
"Fábio Santos" wrote: >> >> >> - >> >> >> 1) The memory gain for many of us (usually non ascii users) >> just become irrelevant. >> >> >>> sys.getsizeof('maçã') >> 41 >> >>> sys.getsizeof('abcd') >> 29 >> >> 2) More critical, Py 3.3, just becomes non unicode compliant, >> (eg European languag

Re: Why sfml does not play the file inside a function in this python code?

2013-05-07 Thread cheirasacan
El martes, 7 de mayo de 2013 12:53:25 UTC+2, MRAB escribió: > On 07/05/2013 10:27, cheirasa...@gmail.com wrote: > > > from tkinter import * > > > import sfml > > > > > > > > > window = Tk() > > > window.minsize( 640, 480 ) > > > > > > > > > def sonido(): > > > file = sfml.Music.from

Re: distributing a binary package

2013-05-07 Thread Eric Frederich
I see where I can specify a module that distutils will try to compile. I already have the .so files compiled. I'm sure its simple, I just can't find it or don't know what to look for. On Mon, May 6, 2013 at 9:13 PM, Miki Tebeka wrote: > >> Basically, I'd like to know how to create a proper setup

Re: Red Black Tree implementation?

2013-05-07 Thread duncan smith
On 07/05/13 02:20, Dan Stromberg wrote: [snip] I'm starting to think Red Black Trees are pretty complex. A while ago I looked at a few different types of self-balancing binary tree. Most look much easier to implement. BTW, the licence might be MIT - I just copied it from someone else's

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Fábio Santos
> > > - > > > 1) The memory gain for many of us (usually non ascii users) > just become irrelevant. > > >>> sys.getsizeof('maçã') > 41 > >>> sys.getsizeof('abcd') > 29 > > 2) More critical, Py 3.3, just becomes non unicode compliant, > (eg European languages or "ascii" typographers !) > > >>> i

Re: First python program, syntax error in while loop

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 10:44 PM, Ombongi Moraa Fe wrote: > My first language was Pascal. It was at a time in 2005 when computers were > finally becoming popular in Africa and our year was the first time a girls > school from our Province did a computer coursework for National Exams. (That > was su

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 11:22 PM, jmfauth wrote: > There are plenty of good reasons to use Python. There are > also plenty of good reasons to not use (or now to drop) > Python and to realize that if you wish to process text > seriously, you are better served by using "corporate > products" or tools

Re: formatted output

2013-05-07 Thread Peter Otten
Roy Smith wrote: > In article , > Sudheer Joseph wrote: > >> Dear members, >> I need to print few arrays in a tabular form for example >> below array IL has 25 elements, is there an easy way to print >> this as 5x5 comma separated table? in python >> >> IL=[

Re: Why do Perl programmers make more money than Python programmers

2013-05-07 Thread jmfauth
On 6 mai, 09:49, Fábio Santos wrote: > On 6 May 2013 08:34, "Chris Angelico" wrote: > > > Well you see, it was 70 bytes back in the Python 2 days (I'll defer to > > Steven for data points earlier than that), but with Python 3, there > > were two versions: one was 140 bytes representing 70 charact

Re: formatted output

2013-05-07 Thread Roy Smith
In article , Sudheer Joseph wrote: > Dear members, > I need to print few arrays in a tabular form for example below > array IL has 25 elements, is there an easy way to print this as > 5x5 comma separated table? in python > > IL=[] > for i in np.arange(1,bno

Re: use python to split a video file into a set of parts

2013-05-07 Thread Dave Angel
On 05/07/2013 07:15 AM, iMath wrote: I use the following python code to split a FLV video file into a set of parts ,when finished ,only the first part video can be played ,the other parts are corrupted.I wonder why and Is there some correct ways to split video files There are two parts to an

formatted output

2013-05-07 Thread Sudheer Joseph
Dear members, I need to print few arrays in a tabular form for example below array IL has 25 elements, is there an easy way to print this as 5x5 comma separated table? in python IL=[] for i in np.arange(1,bno+1): IL.append(i) print(IL) %

Re: use python to split a video file into a set of parts

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 9:15 PM, iMath wrote: > I use the following python code to split a FLV video file into a set of parts > ,when finished ,only the first part video can be played ,the other parts are > corrupted.I wonder why and Is there some correct ways to split video files Most complex f

use python to split a video file into a set of parts

2013-05-07 Thread iMath
I use the following python code to split a FLV video file into a set of parts ,when finished ,only the first part video can be played ,the other parts are corrupted.I wonder why and Is there some correct ways to split video files import sys, os kilobytes = 1024 megabytes = kilobytes * 1000 chunk

unexpected syntax errors

2013-05-07 Thread Robin Becker
A user is getting this error New issue 8: bad raise syntax https://bitbucket.org/rptlab/reportlab/issue/8/bad-raise-syntax File "/usr/lib/python2.7/site-packages/svg2rlg.py", line 16, in from reportlab.graphics import renderPDF File "/usr/lib64/python2.7/site-packages/report

Re: Why sfml does not play the file inside a function in this python code?

2013-05-07 Thread MRAB
On 07/05/2013 10:27, cheirasa...@gmail.com wrote: from tkinter import * import sfml window = Tk() window.minsize( 640, 480 ) def sonido(): file = sfml.Music.from_file('poco.ogg') file.play() test = Button ( window, text = 'Sound test', command=sonido ) test.place ( x = 10, y = 60)

Why sfml does not play the file inside a function in this python code?

2013-05-07 Thread cheirasacan
from tkinter import * import sfml window = Tk() window.minsize( 640, 480 ) def sonido(): file = sfml.Music.from_file('poco.ogg') file.play() test = Button ( window, text = 'Sound test', command=sonido ) test.place ( x = 10, y = 60) window.mainloop() Using Windows 7, Python 3.3, s

Re: First python program, syntax error in while loop

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 4:10 PM, Mark Lawrence wrote: > On 07/05/2013 01:17, alex23 wrote: >> >> On May 6, 10:37 pm, Mark Lawrence wrote: >>> >>> One of these days I'll work out why some people insist on using >>> superfluous parentheses in Python code. Could it be that they enjoy >>> exercising

ANN: eGenix mxODBC Zope/Plone Database Adapter 2.1.2

2013-05-07 Thread eGenix Team: M.-A. Lemburg
ANNOUNCEMENT mxODBC Zope/Plone Database Adapter Version 2.1.2 for Zope and the Plone CMS Available for Plone 4.0, 4.1 and 4.2,