Re: Is it possible to get string from function?

2014-01-16 Thread Peter Otten
Roy Smith wrote: I realize the subject line is kind of meaningless, so let me explain :-) I've got some unit tests that look like: class Foo(TestCase): def test_t1(self): RECEIPT = some string def test_t2(self): RECEIPT = some other string def test_t3(self):

Building and accessing an array of dictionaries

2014-01-16 Thread Sam
I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. dict = {'a':'a','b':'b','c':'c'} dict2 = {'a':'a','b':'b','c':'c'} dict3 = {'a':'a','b':'b','c':'c'} arr = (dict,dict2,dict3) What is the syntax to access the value of

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Chris Angelico
On Thu, Jan 16, 2014 at 8:41 PM, Sam lightai...@gmail.com wrote: I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. dict = {'a':'a','b':'b','c':'c'} dict2 = {'a':'a','b':'b','c':'c'} dict3 = {'a':'a','b':'b','c':'c'} arr =

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Jussi Piitulainen
Sam writes: I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. dict = {'a':'a','b':'b','c':'c'} dict2 = {'a':'a','b':'b','c':'c'} dict3 = {'a':'a','b':'b','c':'c'} arr = (dict,dict2,dict3) What is the syntax to access

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Jean-Michel Pichavant
- Original Message - I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. dict = {'a':'a','b':'b','c':'c'} dict2 = {'a':'a','b':'b','c':'c'} dict3 = {'a':'a','b':'b','c':'c'} arr = (dict,dict2,dict3) What is the

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Robin Becker
On 16/01/2014 00:32, Steven D'Aprano wrote: Or are you saying thatwww.unicode.org is wrong about the definitions of Unicode terms? No, I think he is saying that he doesn't know Unicode anywhere near as well as he thinks he does. The question is, will he cherish his ignorance, or learn from

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Chris Angelico
On Thu, Jan 16, 2014 at 9:51 PM, Robin Becker ro...@reportlab.com wrote: On 16/01/2014 00:32, Steven D'Aprano wrote: Or are you saying thatwww.unicode.org is wrong about the definitions of Unicode terms? No, I think he is saying that he doesn't know Unicode anywhere near as well as he

Re: Is it possible to get string from function?

2014-01-16 Thread Albert-Jan Roskam
On Thu, 1/16/14, Peter Otten __pete...@web.de wrote: Subject: Re: Is it possible to get string from function? To: python-list@python.org Date: Thursday, January 16, 2014, 9:52 AM Roy Smith wrote: I realize the subject line is kind of

Re: Python program distribution - a source of constant friction

2014-01-16 Thread Nicholas Cole
On Tue, Jan 7, 2014 at 12:09 AM, Nicholas Cole nicholas.c...@gmail.com wrote: [SNIP] Even so, things like that are harder to create than they could be, or less prominently documented than one might have expected. Case in point: I have an application a friend/colleague of mine would like to

Re: data validation when creating an object

2014-01-16 Thread Rita
Thanks everyone for the replies. On Thu, Jan 16, 2014 at 1:36 AM, Cameron Simpson c...@zip.com.au wrote: On 16Jan2014 15:53, Ben Finney ben+pyt...@benfinney.id.au wrote: Roy Smith r...@panix.com writes: Ben Finney ben+pyt...@benfinney.id.au wrote: Who says it's frowned on to do

Re: 'Stra�Ye' ('Strasse') and Python 2

2014-01-16 Thread Frank Millman
Robin Becker ro...@reportlab.com wrote in message news:52d7b9be.9020...@chamonix.reportlab.co.uk... On 16/01/2014 00:32, Steven D'Aprano wrote: Or are you saying thatwww.unicode.org is wrong about the definitions of Unicode terms? No, I think he is saying that he doesn't know Unicode

Unicode strings as arguments to exceptions

2014-01-16 Thread Ernest Adrogué
Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. For instance, KeyError seems to not have a problem with them raise KeyError('a') Traceback (most recent call last): File stdin, line 1, in module KeyError: 'a' raise KeyError(u'ä') Traceback (most recent

Re: Python 3.x adoption

2014-01-16 Thread Piet van Oostrum
Travis Griggs travisgri...@gmail.com writes: Personally, I wish they’d start python4, sure would take the heat out of the 3 vs 2 debates. And maybe there’d be a program called twentyfour as a result. twelve would be sufficient, I would think. -- Piet van Oostrum p...@vanoostrum.org WWW:

Re: 'StraÃYe' ('Strasse') and Python 2

2014-01-16 Thread Robin Becker
On 16/01/2014 12:06, Frank Millman wrote: .. I assure you that I fully understand my ignorance of unicode. Until recently I didn't even know that the unicode in python 2.x is considered broken and that str in python 3.x is considered 'better'. Hi Robin I am pretty sure that Steven

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 10:51:42 +, Robin Becker wrote: On 16/01/2014 00:32, Steven D'Aprano wrote: Or are you saying thatwww.unicode.org is wrong about the definitions of Unicode terms? No, I think he is saying that he doesn't know Unicode anywhere near as well as he thinks he does. The

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote: Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. Yes. I believe the problem lies in the __str__ method. For example, KeyError manages to handle Unicode, although in an ugly way: py

Re: Is it possible to get string from function?

2014-01-16 Thread Roy Smith
In article 52d7874d$0$6599$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano st...@pearwood.info wrote: Is the mapping of receipt string to test fixed? That is, is it important that test_t1 *always* runs with some string, test_t2 some other string, and so forth? Yes. --

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Roy Smith
In article 52d7e9a0$0$2$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote: Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. Yes. I

Re: Is it possible to get string from function?

2014-01-16 Thread Peter Otten
Albert-Jan Roskam wrote: On Thu, 1/16/14, Peter Otten __pete...@web.de wrote: class Foo(unittest.TestCase): @unique_receipt(foo) def test_t1(self, RECEIPT): pass Very cool approach. Question, though: what would be wrong with the following approach: import

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Tim Chase
On 2014-01-16 14:07, Steven D'Aprano wrote: The unicode type in Python 2.x is less-good because: - it is missing some functionality, e.g. casefold; Just for the record, str.casefold() wasn't added until 3.3, so earlier 3.x versions (such as the 3.2.3 that is the default python3 on Debian

Re: Is it possible to get string from function?

2014-01-16 Thread Roy Smith
On Thursday, January 16, 2014 5:59:42 AM UTC-5, Albert-Jan Roskam wrote: what would be wrong with the following approach: import unittest class Test(unittest.TestCase): receipts = {} def unique_value(self, k, v): assert Test.receipts.get(k) is None, Duplicate: %s % v

Re: data validation when creating an object

2014-01-16 Thread Roy Smith
On Thursday, January 16, 2014 10:46:10 AM UTC-5, Robert Kern wrote: I prefer to keep my __init__() methods as dumb as possible to retain the flexibility to construct my objects in different ways. Sure, it's convenient to, say, pass a filename and have the __init__() open() it for me. But

Python glob and raw string

2014-01-16 Thread Xaxa Urtiz
Hello everybody, i've got a little problem, i've made a script which look after some files in some directory, typically my folder are organized like this : [share] folder1 -20131201 --file1.xml --file2.txt -20131202 --file9696009.tmp --file421378932.xml etc so basically in the share i've got

Re: data validation when creating an object

2014-01-16 Thread Skip Montanaro
I suspect when best to validate inputs depends on when they come in, and what the cost is of having objects with invalid state. If the input is something that is passed along when the object is instantiated, you kind of have to validate in __init__ or __new__, right? Let's create a stupid

Re: Building and accessing an array of dictionaries

2014-01-16 Thread Mark Lawrence
On 16/01/2014 09:48, Chris Angelico wrote: On Thu, Jan 16, 2014 at 8:41 PM, Sam lightai...@gmail.com wrote: I would like to build an array of dictionaries. Most of the dictionary example on the net are for single dictionary. dict = {'a':'a','b':'b','c':'c'} dict2 = {'a':'a','b':'b','c':'c'}

Re: data validation when creating an object

2014-01-16 Thread Robert Kern
On 2014-01-16 16:18, Roy Smith wrote: On Thursday, January 16, 2014 10:46:10 AM UTC-5, Robert Kern wrote: I prefer to keep my __init__() methods as dumb as possible to retain the flexibility to construct my objects in different ways. Sure, it's convenient to, say, pass a filename and have the

Re: data validation when creating an object

2014-01-16 Thread Robert Kern
On 2014-01-16 04:05, Roy Smith wrote: Rita rmorgan...@gmail.com writes: I know its frowned upon to do work in the __init__() method and only declarations should be there. In article mailman..1389834993.18130.python-l...@python.org, Ben Finney ben+pyt...@benfinney.id.au wrote: Who

Re: Guessing the encoding from a BOM

2014-01-16 Thread Björn Lindqvist
2014/1/16 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: def guess_encoding_from_bom(filename, default): with open(filename, 'rb') as f: sig = f.read(4) if sig.startswith((b'\xFE\xFF', b'\xFF\xFE')): return 'utf_16' elif sig.startswith((b'\x00\x00\xFE\xFF',

Re: Guessing the encoding from a BOM

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 5:01 AM, Björn Lindqvist bjou...@gmail.com wrote: 2014/1/16 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: def guess_encoding_from_bom(filename, default): with open(filename, 'rb') as f: sig = f.read(4) if sig.startswith((b'\xFE\xFF',

Re: Python glob and raw string

2014-01-16 Thread Xaxa Urtiz
Le jeudi 16 janvier 2014 17:49:57 UTC+1, Xaxa Urtiz a écrit : Hello everybody, i've got a little problem, i've made a script which look after some files in some directory, typically my folder are organized like this : [share] folder1 -20131201 --file1.xml --file2.txt

Re: Python glob and raw string

2014-01-16 Thread Neil Cerutti
On 2014-01-16, Xaxa Urtiz urtizvereax...@gmail.com wrote: Hello everybody, i've got a little problem, i've made a script which look after some files in some directory, typically my folder are organized like this : [share] folder1 -20131201 --file1.xml --file2.txt -20131202

Re: Python glob and raw string

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 5:14 AM, Neil Cerutti ne...@norwich.edu wrote: class Miner: def __init__(self, archive): # setup goes here; prepare to acquire the data self.descend(os.path.join(archive, '*')) def descend(self, path): for fname in

Re: Python glob and raw string

2014-01-16 Thread Neil Cerutti
On 2014-01-16, Chris Angelico ros...@gmail.com wrote: Hmmm... I might be doing too much in __init__. ;) Hmm, why is it even a class? :) I guess you elided all the stuff that makes it impractical to just use a non-class function. I didn't remove anything that makes it obviously class-worthy,

Re: Guessing the encoding from a BOM

2014-01-16 Thread Tim Chase
On 2014-01-17 05:06, Chris Angelico wrote: You might want to add the utf8 bom too: '\xEF\xBB\xBF'. I'd actually rather not. It would tempt people to pollute UTF-8 files with a BOM, which is not necessary unless you are MS Notepad. If the intent is to just sniff and parse the file

Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Harry Spier
Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc. Each of these subdirectories contains about a hundred JPEGs named P001.jpg, P002.jpg, P003.jpg etc. I need to write a python script that will cycle thru each directory and

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 19:11, Harry Spier wrote: Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc. Each of these subdirectories contains about a hundred JPEGs named P001.jpg, P002.jpg, P003.jpg etc. I need to write a python script

Re: Guessing the encoding from a BOM

2014-01-16 Thread Albert-Jan Roskam
On Thu, 1/16/14, Chris Angelico ros...@gmail.com wrote: Subject: Re: Guessing the encoding from a BOM To: Cc: python-list@python.org python-list@python.org Date: Thursday, January 16, 2014, 7:06 PM On Fri, Jan 17, 2014 at 5:01 AM, Björn

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread vasishtha . spier
On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: On 16/01/2014 19:11, Harry Spier wrote: Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc. Each of these subdirectories contains about a

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Mark Lawrence
On 16/01/2014 19:50, vasishtha.sp...@gmail.com wrote: On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: On 16/01/2014 19:11, Harry Spier wrote: Dear list members, I have a directory that contains about a hundred subdirectories named J0001,J0002,J0003 . . . etc.

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 19:50, vasishtha.sp...@gmail.com wrote: On Thursday, January 16, 2014 11:41:04 AM UTC-8, Tim Golden wrote: The usual go-to library for PDF generation is ReportLab. I haven't used it for a long while but I'm quite certain it would have no problem including images. Do I take it

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread Tim Golden
On 16/01/2014 20:07, Tim Golden wrote: This should walk down the Python directory, s/the Python directory/some directory/ (Sorry, I initially had it walking os.path.dirname(sys.executable)) TJG -- https://mail.python.org/mailman/listinfo/python-list

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread vasishtha . spier
On Thursday, January 16, 2014 12:12:01 PM UTC-8, Tim Golden wrote: On 16/01/2014 20:07, Tim Golden wrote: This should walk down the Python directory, s/the Python directory/some directory/ (Sorry, I initially had it walking os.path.dirname(sys.executable)) TJG Thanks Tim thats very

Re: 'Straße' ('Strasse') and Python 2

2014-01-16 Thread Travis Griggs
On Jan 16, 2014, at 2:51 AM, Robin Becker ro...@reportlab.com wrote: I assure you that I fully understand my ignorance of ... Robin, don’t take this personally, I totally got what you meant. At the same time, I got a real chuckle out of this line. That beats “army intelligence” any day. --

Python solve problem with string operation

2014-01-16 Thread Nac Temha
Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : 3443331123377 operation- (3)(44)()(333)(11)(2)(33)(77) output: 34131237 How can I do without list, regular expression. just using string

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
In mailman.5607.1389911083.18130.python-l...@python.org Nac Temha nacctte...@gmail.com writes: --047d7b6d95d0367a3d04f01de490 Content-Type: text/plain; charset=ISO-8859-1 Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For

Re: Python solve problem with string operation

2014-01-16 Thread Tim Chase
On 2014-01-17 00:24, Nac Temha wrote: Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : 3443331123377 operation- (3)(44)()(333)(11)(2)(33)(77) output: 34131237 How can I do without

Re: Python solve problem with string operation

2014-01-16 Thread Mark Lawrence
On 16/01/2014 22:30, John Gordon wrote: In mailman.5607.1389911083.18130.python-l...@python.org Nac Temha nacctte...@gmail.com writes: --047d7b6d95d0367a3d04f01de490 Content-Type: text/plain; charset=ISO-8859-1 Hi everyone, I want to do operation with chars in the given string. Actually

Re: Python solve problem with string operation

2014-01-16 Thread John Gordon
In mailman.5609.1389912537.18130.python-l...@python.org Mark Lawrence breamore...@yahoo.co.uk writes: input = 3443331123377 output = [] previous_ch = None for ch in input: if ch != previous_ch: output.append(ch) previous_ch = ch print

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Terry Reedy
On 1/16/2014 7:34 AM, Ernest Adrogué wrote: Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. For instance, KeyError seems to not have a problem with them raise KeyError('a') Traceback (most recent call last): File stdin, line 1, in module KeyError:

Re: Unicode strings as arguments to exceptions

2014-01-16 Thread Terry Reedy
On 1/16/2014 9:16 AM, Steven D'Aprano wrote: On Thu, 16 Jan 2014 13:34:08 +0100, Ernest Adrogué wrote: Hi, There seems to be some inconsistency in the way exceptions handle Unicode strings. Yes. I believe the problem lies in the __str__ method. For example, KeyError manages to handle

Re: Guessing the encoding from a BOM

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 6:37 AM, Albert-Jan Roskam fo...@yahoo.com wrote: Can you elaborate on that? Unless your utf-8 files will only contain ascii characters I do not understand why you would not want a bom utf-8. It's completely unnecessary, and could cause problems (the BOM is actually

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
Nac Temha nacctte...@gmail.com writes: Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : 3443331123377 operation- (3)(44)()(333)(11)(2)(33)(77) output: 34131237 How can I do without

Re: Python solve problem with string operation

2014-01-16 Thread Denis McMahon
On Fri, 17 Jan 2014 00:24:40 +0200, Nac Temha wrote: Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : 3443331123377 operation- (3)(44)()(333)(11)(2)(33)(77) output: 34131237 How can

Re: Python solve problem with string operation

2014-01-16 Thread giacomo boffi
giacomo boffi pec...@pascolo.net writes: % python a.py 34131237 % cat a.py i=3443331123377;n=0 while n+1!=len(i):i,n=(i[:n]+i[n+1:],n) if i[n+1]==i[n] else (i,n+1) print i % python a.py 34131237 % -- for Nikos -- https://mail.python.org/mailman/listinfo/python-list

Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Sam
I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .pyo offer better protection? -- https://mail.python.org/mailman/listinfo/python-list

Re: interactive help on the base object

2014-01-16 Thread Terry Reedy
On 12/6/2013 8:35 PM, Terry Reedy wrote: On 12/6/2013 12:03 PM, Mark Lawrence wrote: Is it just me, or is this basically useless? help(object) Help on class object in module builtins: class object | The most base type Given that this can be interpreted as 'least desirable', it could

Compiling main script into .pyc

2014-01-16 Thread Sam
One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? It is to inconvenience potential copy-cats. --

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Ned Batchelder
On 1/16/14 7:58 PM, Sam wrote: I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .pyo offer better protection? First, .pyc and .pyo are

Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Sam
I have a datafeed which is constantly sent to a MySql table. The table grows constantly as the data feeds in. I would like to write a python script which process the data in this table and output the processed data to another table in another MySql database in real-time. Which are the python

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Chris Angelico
On Fri, Jan 17, 2014 at 11:58 AM, Sam lightai...@gmail.com wrote: I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. Is it possible to protect python source code by compiling it to .pyc or .pyo? Does .pyo offer better

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Ben Finney
Sam lightai...@gmail.com writes: I would like to protect my python source code. Protect it from what? If there's some specific activity you want to prevent or restrict, please say what it is, since “protect” is a rather loaded term. It need not be foolproof as long as it adds inconvenience to

Re: Python solve problem with string operation

2014-01-16 Thread Rhodri James
On Thu, 16 Jan 2014 22:24:40 -, Nac Temha nacctte...@gmail.com wrote: Hi everyone, I want to do operation with chars in the given string. Actually I want to grouping the same chars. For example; input : 3443331123377 operation- (3)(44)()(333)(11)(2)(33)(77) output:

Re: Guessing the encoding from a BOM

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 11:37:29 -0800, Albert-Jan Roskam wrote: On Thu, 1/16/14, Chris Angelico ros...@gmail.com wrote: Subject: Re: Guessing the encoding from a BOM To: Cc: python-list@python.org python-list@python.org Date: Thursday, January

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Ethan Furman
On 01/16/2014 05:09 PM, Chris Angelico wrote: On Fri, Jan 17, 2014 at 11:58 AM, Sam lightai...@gmail.com wrote: I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. Is it possible to protect python source code by compiling it to

Re: Guessing the encoding from a BOM

2014-01-16 Thread Tim Chase
On 2014-01-17 11:14, Chris Angelico wrote: UTF-8 specifies the byte order as part of the protocol, so you don't need to mark it. You don't need to mark it when writing, but some idiots use it anyway. If you're sniffing a file for purposes of reading, you need to look for it and remove it from

Re: Python solve problem with string operation

2014-01-16 Thread Asaf Las
inpu = 3443331123377 tstr = inpu[0] for k in range(1, len(inpu)): if inpu[k] != inpu[k-1] : tstr = tstr + inpu[k] print(tstr) -- https://mail.python.org/mailman/listinfo/python-list

Re: Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Denis McMahon
On Thu, 16 Jan 2014 17:03:24 -0800, Sam wrote: I have a datafeed which is constantly sent to a MySql table ... Which are the python libraries which are suitable for this purpose? Are there any useful sample code or project on the web that I can use as reference? Did you search for mysql on

Re: Process datafeed in one MySql table and output to another MySql table

2014-01-16 Thread Jason Friedman
I have a datafeed which is constantly sent to a MySql table. The table grows constantly as the data feeds in. I would like to write a python script which process the data in this table and output the processed data to another table in another MySql database in real-time. Which are the

Re: Compiling main script into .pyc

2014-01-16 Thread bob gailer
On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? Duh? Just import it! --

Re: Compiling main script into .pyc

2014-01-16 Thread Ned Batchelder
On 1/16/14 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? It is to inconvenience potential copy-cats.

Re: Compiling main script into .pyc

2014-01-16 Thread MRAB
On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile the main script into .pyc? Duh?

Re: Compiling main script into .pyc

2014-01-16 Thread Dave Angel
MRAB pyt...@mrabarnett.plus.com Wrote in message: On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I

Re: Compiling main script into .pyc

2014-01-16 Thread Terry Reedy
On 1/16/2014 10:19 PM, MRAB wrote: On 2014-01-17 02:56, bob gailer wrote: On 1/16/2014 8:01 PM, Sam wrote: One thing I observe about python byte-code compiling is that the main script does not gets compiled into .pyc. Only imported modules are compiled into .pyc. May I know how can I compile

Re: Guessing the encoding from a BOM

2014-01-16 Thread Rustom Mody
On Friday, January 17, 2014 7:10:05 AM UTC+5:30, Tim Chase wrote: On 2014-01-17 11:14, Chris Angelico wrote: UTF-8 specifies the byte order as part of the protocol, so you don't need to mark it. You don't need to mark it when writing, but some idiots use it anyway. If you're sniffing a

Re: Is it possible to protect python source code by compiling it to .pyc or .pyo?

2014-01-16 Thread Steven D'Aprano
On Thu, 16 Jan 2014 16:58:48 -0800, Sam wrote: I would like to protect my python source code. It need not be foolproof as long as it adds inconvenience to pirates. What makes you think that pirates will be the least bit interested in your code? No offence intended, I'm sure you worked really,

Re: Converting folders of jpegs to single pdf per folder

2014-01-16 Thread vasishtha . spier
On Thursday, January 16, 2014 12:07:59 PM UTC-8, Tim Golden wrote: Here's a quick example. This should walk down the Python directory, creating a text file for each directory. The textfile will contain the names of all the files in the directory. (NB this might create a lot of text files

Re: extracting string.Template substitution placeholders

2014-01-16 Thread gmflanagan
On Sunday, January 12, 2014 3:08:31 PM UTC, Eric S. Johansson wrote: As part of speech recognition accessibility tools that I'm building, I'm using string.Template. In order to construct on-the-fly grammar, I need to know all of the identifiers before the template is filled in. what is

[issue20256] Argument Clinic: compare signed and unsigned ints

2014-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: (unsigned int)-1 etc. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20256 ___ ___ Python-bugs-list mailing

[issue20262] Convert some debugging prints in zipfile to warnings

2014-01-16 Thread Larry Hastings
Larry Hastings added the comment: I will bow to the wisdom of my predecessor and accept this patch for beta 3. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20262 ___

[issue20133] Derby: Convert the audioop module to use Argument Clinic

2014-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I mean I want to add support for float32 and float64 in audioop functions. In that case return value of getsample(), max(), ets will be no longer integer for float format. -- ___ Python tracker

[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings
Larry Hastings added the comment: Okay, I have a fix for the help(os.chmod) problem, that'll be in the next refreshed patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20226 ___

[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Why not allow arbitrary string as py_default? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20226 ___ ___

[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings
Larry Hastings added the comment: Isn't that what it does? I may actually remove py_default. Nobody uses it, and I don't think you need it--you just specify what you want as the real default value. -- ___ Python tracker rep...@bugs.python.org

[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild
New submission from xwild: Why the python sets the __debug__ builtin = True by default? It causes that people never use the assert construction by their programms in a regular way. it's too hard to explain everyone that -O is required by a script. It's very usefull instruction and actually

[issue20276] ctypes._dlopen should not force RTLD_NOW

2014-01-16 Thread STINNER Victor
STINNER Victor added the comment: FYI, dlopen() flags are configurable: - sys.setdlopenflags(n): default=RTLD_NOW (if available, or RTLD_LAZY otherwise) - mode parameter of dl.dlopen(): default=RTLD_LAZY - mode parameter of ctypes.CDLL: default=RTLD_LOCAL (but RTLD_GLOBAL on Mac OS X = 10.3);

[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2014-01-16 Thread Georg Brandl
Georg Brandl added the comment: New patch addressing comments. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20182 ___ ___ Python-bugs-list

[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2014-01-16 Thread Georg Brandl
Changes by Georg Brandl ge...@python.org: Added file: http://bugs.python.org/file33491/modules_issue20182_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20182 ___

[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Larry Hastings
Larry Hastings added the comment: Second rollup patch. More small fixes, many suggested by other folks. -- Added file: http://bugs.python.org/file33492/larry.clinic.rollup.patch.two.diff.2.txt ___ Python tracker rep...@bugs.python.org

[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It would be better if you commit a patch which changes PyTuple_Size to PyTuple_GET_SIZE in separate commit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20226

[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild
Changes by xwild xwild.w...@gmail.com: -- versions: -3rd party ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20277 ___ ___ Python-bugs-list

[issue20278] Wrong URL to the pysqlite web page

2014-01-16 Thread Richard Philips
New submission from Richard Philips: The reference to the pysqlite web page on: http://docs.python.org/3.4/library/sqlite3.html should be: https://github.com/ghaering/pysqlite -- assignee: docs@python components: Documentation messages: 208261 nosy: Richard.Philips,

[issue20227] Argument Clinic: rename arguments in generated C?

2014-01-16 Thread Ryan Smith-Roberts
Ryan Smith-Roberts added the comment: The use case is primarily to minimize code churn for the derby, but since you're the one (heroically) doing the code review it's really your call. I whipped up a quick patch for this feature, and even if you remove c_name from __init__ I think it's still

[issue20227] Argument Clinic: rename arguments in generated C?

2014-01-16 Thread Ryan Smith-Roberts
Changes by Ryan Smith-Roberts r...@lab.net: Added file: http://bugs.python.org/file33494/argument_clinic_ensure_legal_cleanup.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20227 ___

[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild
Changes by xwild xwild.w...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20277 ___ ___ Python-bugs-list

[issue20277] default __debug__ value and asserts

2014-01-16 Thread xwild
Changes by xwild xwild.w...@gmail.com: -- nosy: +ezio.melotti, michael.foord, pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20277 ___ ___

[issue20275] asyncio: remove debug code from BaseEventLoop

2014-01-16 Thread STINNER Victor
STINNER Victor added the comment: I like logger_is_enabled_for.patch. I prefer debug_flag.patch because it is faster than logger_is_enabled_for.patch (see msg208214). I would like to write the most efficient code for BaseEventLoop._run_once() because this function is the real core of asyncio

[issue20174] Derby #5: Convert 50 sites to Argument Clinic across 3 files

2014-01-16 Thread Ryan Smith-Roberts
Ryan Smith-Roberts added the comment: Here's sendmsg with only nested bracket optional args. If Rietveld doesn't like this patch I may cry. -- Added file: http://bugs.python.org/file33496/argument_clinic_socketmodule_v4.patch ___ Python tracker

[issue20232] Argument Clinic NULL default falsely implies None acceptability

2014-01-16 Thread Ryan Smith-Roberts
Ryan Smith-Roberts added the comment: After all our discussions I'm closing this with resolution don't do that then. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20232

[issue20226] Argument Clinic: support for simple expressions?

2014-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Excellent! I'm rewriting the zlib module and the code becomes much cleaner with this patch. There is one problem left -- Py_buffer doesn't support default value at all. Such code /*[clinic input] zlib.compressobj zdict: Py_buffer = unspecified [clinic

[issue20277] default __debug__ value and asserts

2014-01-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Specify the -O option in she-bang: #!/usr/bin/env python3 -O -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20277 ___

  1   2   >