sqlite3.OperationalError: near ".": syntax error

2014-09-19 Thread luofeiyu
C:\Users\pengsir>sqlite3 F:\\workspace\\china\\data\\china.sqlite SQLite version 3.8.5 2014-06-04 14:06:34 Enter ".help" for usage hints. sqlite> .tables balance cash fi_di ipo profile quote capital dividend fund majority profit sqlite>

sqlite3.OperationalError: near ".": syntax error

2014-09-19 Thread luofeiyu
C:\Users\pengsir>d:\\sqlite3 F:\\workspace\\china\\data\\china.sqlite SQLite version 3.8.5 2014-06-04 14:06:34 Enter ".help" for usage hints. sqlite> .tables balance cash fi_di ipo profile quote capital dividend fund majority profit sqlite>

Re: sqlite3.OperationalError: near ".": syntax error

2014-09-19 Thread Lele Gaifax
luofeiyu writes: > why " cur.execute('.tables') " can't get output? Most probably because that is not an SQL statement, but a command implemented by the SQLite command line client. To get the list of tables, the following may work for you: >>> import sqlite3 >>> con = sqlite3.connect('devel

Re: sqlite3.OperationalError: near ".": syntax error

2014-09-19 Thread Peter Otten
luofeiyu wrote: > C:\Users\pengsir>d:\\sqlite3 F:\\workspace\\china\\data\\china.sqlite > SQLite version 3.8.5 2014-06-04 14:06:34 > Enter ".help" for usage hints. > sqlite> .tables > balance cash fi_di ipo profile quote > capital dividend fund

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Sep 19, 2014 at 3:15 PM, Steven D'Aprano > wrote: >> However, as far as I am aware, there are no built-ins that will fail that >> test, yet. Although the iteration order of dicts and sets is arbitrary, I >> think that (at least to date) it will be the same order ev

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Sep 19, 2014 at 3:45 PM, Steven D'Aprano > wrote: >> s = '\0'.join([thishost, md5sum, dev, ino, nlink, size, file_path]) >> print s > > That won't work on its own; several of the values are integers. Ah, so they are! > So > either they need to be str(

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Chris Angelico
On Fri, Sep 19, 2014 at 8:59 PM, Steven D'Aprano wrote: >> https://docs.python.org/3.4/library/stdtypes.html#dict-views >> """If keys, values and items views are iterated over with no >> intervening modifications to the dictionary, the order of items will >> directly correspond.""" >> So if iterat

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Chris Angelico
On Fri, Sep 19, 2014 at 8:59 PM, Steven D'Aprano wrote: > Here's a proof of concept of what would be allowed: > > import random > class MyDict: > def __init__(self, items): > self._items = list(dict(items).items()) > self._flags = [False, False, False] > def keys(self): >

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Chris Angelico
On Fri, Sep 19, 2014 at 9:04 PM, Steven D'Aprano wrote: >> Hmm, you sure exit won't work? > > In the interactive interpreter, exit is bound to a special helper object: > > py> exit > Use exit() or Ctrl-D (i.e. EOF) to exit > > Otherwise, you'll get NameError. It's not the interactive interpreter

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Sep 19, 2014 at 8:59 PM, Steven D'Aprano > wrote: >> Here's a proof of concept of what would be allowed: [...] > Also, this can't possibly offer the same guarantee. Watch: > > d = MyDict(some_lot_of_items) > d.values(); d.items() > # mutate the dict in whatever wa

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Chris Angelico
On Fri, Sep 19, 2014 at 9:46 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> On Fri, Sep 19, 2014 at 8:59 PM, Steven D'Aprano >> wrote: >>> Here's a proof of concept of what would be allowed: > [...] >> Also, this can't possibly offer the same guarantee. Watch: >> >> d = MyDict(some_lot_o

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Sep 19, 2014 at 8:59 PM, Steven D'Aprano > wrote: >>> https://docs.python.org/3.4/library/stdtypes.html#dict-views >>> """If keys, values and items views are iterated over with no >>> intervening modifications to the dictionary, the order of items will >>> directly

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Chris Angelico
On Fri, Sep 19, 2014 at 9:58 PM, Steven D'Aprano wrote: > All it says is that keys/values/items will correspond, not keys/keys, etc. > > Hmmm. On second thought, there is a problem with this: > > a = list(mydict) > c = list(mydict.items()) # now the internal order is shuffled > b = list(mydict.va

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread alister
On Fri, 19 Sep 2014 21:56:05 +1000, Chris Angelico wrote: > On Fri, Sep 19, 2014 at 9:46 PM, Steven D'Aprano > wrote: >> Chris Angelico wrote: >> >>> On Fri, Sep 19, 2014 at 8:59 PM, Steven D'Aprano >>> wrote: Here's a proof of concept of what would be allowed: >> [...] >>> Also, this can't

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Chris Angelico
On Fri, Sep 19, 2014 at 10:26 PM, alister wrote: > As far as I understand it the order of keys in a dict is not guaranteed > iterating over the same dict twice (without changes) does not have to > return the keys in the same order. The exact guarantee is that you can iterate over keys() followed

Fwd: program to generate data helpful in finding duplicate large files

2014-09-19 Thread David Alban
here is my reworked code in a plain text email. -- Forwarded message -- From: Date: Thu, Sep 18, 2014 at 3:58 PM Subject: Re: program to generate data helpful in finding duplicate large files To: python-list@python.org thanks for the responses. i'm having quite a good time lea

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Chris Angelico
On Fri, Sep 19, 2014 at 11:32 PM, David Alban wrote: > thanks for the responses. i'm having quite a good time learning python. Awesome! But while you're at it, you may want to consider learning English on the side; capitalization does make your prose more readable. Also, it makes you look carel

Re: hashlib suddenly broken

2014-09-19 Thread Larry Martell
On Thu, Sep 18, 2014 at 11:00 PM, Steven D'Aprano wrote: > Ned Deily wrote: > >> In article >> , >> Larry Martell wrote: >>> Do you think I should install this update? Perhaps that would restore >>> whatever is missing. >> >> Yes. You should install the update in any case and it's unlikely to ma

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Sep 19, 2014 at 11:32 PM, David Alban wrote: >> thanks for the responses. i'm having quite a good time learning python. > > Awesome! But while you're at it, you may want to consider learning > English on the side; capitalization does make your prose more > reada

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Chris Angelico
On Sat, Sep 20, 2014 at 2:22 AM, Steven D'Aprano wrote: > I heard one of them mention that even though he sees the words are > misspelled, he deliberately doesn't bother fixing them because its not > important. I guess he just liked the look of his text having highlighted > words scattered through

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Ian Kelly
On Fri, Sep 19, 2014 at 12:45 AM, Chris Angelico wrote: > On Fri, Sep 19, 2014 at 3:45 PM, Steven D'Aprano >> s = '\0'.join([thishost, md5sum, dev, ino, nlink, size, file_path]) >> print s > > That won't work on its own; several of the values are integers. So > either they need to be str()

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Chris Angelico
On Sat, Sep 20, 2014 at 3:20 AM, Ian Kelly wrote: > On Fri, Sep 19, 2014 at 12:45 AM, Chris Angelico wrote: >> On Fri, Sep 19, 2014 at 3:45 PM, Steven D'Aprano >>> s = '\0'.join([thishost, md5sum, dev, ino, nlink, size, file_path]) >>> print s >> >> That won't work on its own; several of

Re: the python shell window is already executing a command

2014-09-19 Thread Terry Reedy
On 9/18/2014 10:51 PM, Chris Angelico wrote: On Fri, Sep 19, 2014 at 5:05 AM, Terry Reedy wrote: A couple more questions; after you run the file once, is there a warning above the first >>> prompt? If, after the program stop and you see a second prompt and run import sys; len(sys.modules), 'a

Re: the python shell window is already executing a command

2014-09-19 Thread Chris Angelico
On Sat, Sep 20, 2014 at 5:43 AM, Terry Reedy wrote: > On 9/18/2014 10:51 PM, Chris Angelico wrote: >> >> On Fri, Sep 19, 2014 at 5:05 AM, Terry Reedy wrote: >>> >>> A couple more questions; after you run the file once, is there a warning >>> above the first >>> prompt? If, after the program stop

Google Appengine Proxy Post method error

2014-09-19 Thread alextrapp
So I got the Labnol Google Appengine proxy but it can't handle the Post method aka error 405. I need help adding this method to the script: mirror.py = http://pastebin.com/2zRsdi3U transform_content.py = http://pastebin.com/Fw7FCncA main.html = http://pastebin.com/HTBH3y5T All other files are

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Terry Reedy
On 9/18/2014 10:45 PM, Chris Angelico wrote: On Fri, Sep 19, 2014 at 9:52 AM, Roy Smith wrote: In article , Chris Angelico wrote: The one thing you can rely on (and therefore must comply with, when you design an iterable) is that iteration will hit every element in what, a collection tha

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Steven D'Aprano
Chris Angelico wrote: > On Fri, Sep 19, 2014 at 9:04 PM, Steven D'Aprano > wrote: >>> Hmm, you sure exit won't work? >> >> In the interactive interpreter, exit is bound to a special helper object: >> >> py> exit >> Use exit() or Ctrl-D (i.e. EOF) to exit >> >> Otherwise, you'll get NameError. >

Python assignment auto-grading

2014-09-19 Thread Frank Cui
Hi Folks, I'm seeking some suggestions and recommendations for python assignments auto grading. Hopefully this tool will have all or some of the following attributes : 1) Easy to set up and maintain (i.e. minimal workload in terms of sysadmin and webdev, is there a recommended cloud service ? )2)

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Cameron Simpson
On 19Sep2014 23:59, Chris Angelico wrote: On Fri, Sep 19, 2014 at 11:32 PM, David Alban wrote: if you omit the exit statement it in this example, and $report_mode is not set, your shell program will give a non-zero return code and appear to have terminated with an error. in shell the last exp

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Cameron Simpson
On 20Sep2014 02:22, Steven D'Aprano wrote: [...] I used to work with programmers whose spelling is awful. [...] nevertheless their commit messages and documentation was full of things like "make teh function reqire a posative index". [...] I heard one of them mention that even though he sees th

Re: Python docs not accessible from IDLE

2014-09-19 Thread Terry Reedy
On 9/17/2014 8:46 PM, Ned Deily wrote: In article , Terry Reedy wrote: Ned, is there any reason to not add the trailing '/' to the url for 3.4.2? I verified that it is being added by python.org when connecting from win7 with FF. How about adding the 's' for 'https'? There is no reason not t

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Chris Angelico
On Sat, Sep 20, 2014 at 9:33 AM, Steven D'Aprano wrote: > It's a bad idea to rely on features added to site.py, since they aren't > necessarily going to be available at all sites or in all implementations: > > steve@orac:/home/steve$ ipy > IronPython 2.6 Beta 2 DEBUG (2.6.0.20) on .NET 2.0.50727.1

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Chris Angelico
On Sat, Sep 20, 2014 at 10:27 AM, Cameron Simpson wrote: > IMO, it is good that the shell is like that. It isn't Python. > > A great many small shell scripts are one liner wrappers, and this serves > them well. A great many more are a lot of prep work followed by a major (and > final) command. The

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-19 Thread Chris Angelico
On Sat, Sep 20, 2014 at 8:02 AM, Terry Reedy wrote: >> That's what you're iterating over - not the bag itself. > > If one iterates over anything other that a sequence, in forward order, then > one is, in effect, iterating over a new sequence generated from the 'base' > collection. In particular,

Re: program to generate data helpful in finding duplicate large files

2014-09-19 Thread Ben Finney
Steven D'Aprano writes: > I heard one [programmer] mention that even though he sees the words > are misspelled, he deliberately doesn't bother fixing them because its > not important. I guess he just liked the look of his text having > highlighted words scattered throughout the editor. If it's w