[Tutor] problem with simple sqlite script

2008-11-07 Thread aivars
Hello, I am getting frustrated. I have been successfully inserting, deleting, etc records with python and sqlite no problem. Suddenly the following very simple scrip does not work: import sqlite3 sPath=r'e:\pythonexamples\aivars2.db' con=sqlite3.connect(sPath) cur=con.cursor()

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Alan Gauld
[EMAIL PROTECTED] wrote on more intermediate/advanced topics like linked lists, nodes, trees, etc. However, it's kind of like reading a math textbook Thats because these are abstract theoretical concepts at the root of programming but not used much in practice in high level languages like

Re: [Tutor] please help with sqlite replace function

2008-11-07 Thread Alan Gauld
aivars [EMAIL PROTECTED] wrote Yes it seems you are right. The ActiveState python version I have installed have sqlite 2.3.2 only. I find it strange. Why? SQLite is a separate product. Python bundled the then current version in its standard distribution, but time has moved on. You have

Re: [Tutor] problem with simple sqlite script

2008-11-07 Thread Alan Gauld
aivars [EMAIL PROTECTED] wrote sPath=r'e:\pythonexamples\aivars2.db' con=sqlite3.connect(sPath) cur=con.cursor() cur.execute(insert into test (name) values (?),sPath) con.commit() File E:\PythonExamples\test.py, line 7, in module cur.execute(insert into test (name) values (?),sPath)

Re: [Tutor] please help with sqlite replace function

2008-11-07 Thread aivars
Hello, Denis, Please try what sqlite3.version shows on your machine? Thanks aivars 2008/11/7 spir [EMAIL PROTECTED]: aivars a écrit : Thanks, John, Yes it seems you are right. The ActiveState python version I have installed have sqlite 2.3.2 only. I find it strange. I also have

[Tutor] pattern expressions

2008-11-07 Thread spir
Hello, I'm learning to use parsers: trying pyParsing, construct and simpleparse to have a better overview. I know a bit regular expressions and rather used to BNF-like formats such as used for specification of languages. But I have never really employed them personly, so the following may be

Re: [Tutor] problem with simple sqlite script

2008-11-07 Thread Kent Johnson
On Fri, Nov 7, 2008 at 3:49 AM, aivars [EMAIL PROTECTED] wrote: import sqlite3 sPath=r'e:\pythonexamples\aivars2.db' con=sqlite3.connect(sPath) cur=con.cursor() cur.execute(insert into test (name) values (?),sPath) The second argument to execute() is a *sequence* of parameter values. A

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Kent Johnson
On Thu, Nov 6, 2008 at 11:14 PM, [EMAIL PROTECTED] wrote: Hi everyone, I've been teaching myself python for a few months and I'm becoming frustrated because I've kind of hit a wall in terms of learning new information. You might like to read the (printed) Python Cookbook. It has many good

Re: [Tutor] problem with simple sqlite script

2008-11-07 Thread aivars
Thanks, Alan, here is a create statement: CREATE TABLE test (name TEXT) And also I would like to thank you for you web page. Classes and OOP seems to start to make sense to me now slowly after I am reading your material. Aivars 2008/11/7 Alan Gauld [EMAIL PROTECTED]: aivars [EMAIL

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread W W
On Fri, Nov 7, 2008 at 4:12 AM, Eric Abrahamsen [EMAIL PROTECTED]wrote: snip Also, are there other concepts that I should focus on? Frankly, I'm a bit bored because I've hit this ceiling, and I'm not really sure where to go to next. If you want to learn all sorts of new and exciting

Re: [Tutor] problem with simple sqlite script

2008-11-07 Thread aivars
Kent, Yesss!! That did the trick! It's worth to remeber. Thank you very much! Aivars 2008/11/7 Kent Johnson [EMAIL PROTECTED]: On Fri, Nov 7, 2008 at 3:49 AM, aivars [EMAIL PROTECTED] wrote: import sqlite3 sPath=r'e:\pythonexamples\aivars2.db' con=sqlite3.connect(sPath)

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Eric Abrahamsen
On Nov 7, 2008, at 12:14 PM, [EMAIL PROTECTED] wrote: Hi everyone, I've been teaching myself python for a few months and I'm becoming frustrated because I've kind of hit a wall in terms of learning new information. In an effort to continue to learn I've found some material on more

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Kent Johnson
On Fri, Nov 7, 2008 at 4:12 AM, Alan Gauld [EMAIL PROTECTED] wrote: For example a linked list is pretty much a Python list. Other than the very different timing characteristics! Python lists are O(1) for reading or writing a value at an index, O(n) for inserting and deleting. Linked lists are

Re: [Tutor] How to use function from specific module and then switch to other module

2008-11-07 Thread Ertl, John C CIV 63134
Classification: UNCLASSIFIED Caveat (s): FOUO Kent, Thanks for the lead. I eventually did something like the Strategy Pattern you sent. It was so much simpler when I just inherited the functions. I think I need to redesign the code but for now it works and my boss will be happy. Thanks

[Tutor] Torrent

2008-11-07 Thread Ahmet Yasin HAZER
___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Lie Ryan
On Thu, 06 Nov 2008 23:14:38 -0500, btkuhn wrote: Hi everyone, I've been teaching myself python for a few months and I'm becoming frustrated because I've kind of hit a wall in terms of learning new information. In an effort to continue to learn I've found some material on more

Re: [Tutor] pattern expressions

2008-11-07 Thread spir
Paul McGuire a écrit : Question 1: format_code:= '+' | '-' | '*' | '#' I need to specify that a single, identical, format_code code may be repeated. Not that a there may be several one on a sequence. format := (format_code)+ would catch '+-', which is wrong. I want only

Re: [Tutor] pattern expressions

2008-11-07 Thread Kent Johnson
On Fri, Nov 7, 2008 at 4:22 PM, spir [EMAIL PROTECTED] wrote: This guy who develops pyParsing thinks at everything. There are so many helper functions and processing methods -- how can you know all of that by heart, Paul ? Maybe because he *is* the guy who develops pyparsing? ;-) Kent

Re: [Tutor] please help with sqlite replace function

2008-11-07 Thread Alan Gauld
aivars [EMAIL PROTECTED] wrote Please try what sqlite3.version shows on your machine? I also have ActiveState's python (mainly for its very good doc) and I get: import sqlite3 sqlite3.sqlite_version '3.3.4' Me too with Python 2.5.1 from Activestate. Alan G

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Alan Gauld
Kent Johnson [EMAIL PROTECTED] wrote For example a linked list is pretty much a Python list. Other than the very different timing characteristics! True, but its pretty rare that timing issues are a reason for me to choose a data structure - especially if I need to hand code it! :-)

Re: [Tutor] problem with simple sqlite script

2008-11-07 Thread ALAN GAULD
CREATE TABLE test (name TEXT) OK, That looks fine. con=sqlite3.connect(sPath) cur=con.cursor() cur.execute(insert into test (name) values (?),sPath) Try putting the string variable in a tuple: cur.execute(insert into test (name) values (?), (sPath,) ) That seems to work for me...

[Tutor] gnuplot from a python gui

2008-11-07 Thread dwbarne
Hello tutors, I'm trying to generate a plot using gnuplot from within a python gui. In Windows, if after the plot is drawn I use a raw_input string demanding a 'RETURN' be hit, the plot will persist on the screen until the 'RETURN' is pressed. In *nix, one can use the 'persist' switch to

Re: [Tutor] Intermediate/advanced concepts

2008-11-07 Thread Kent Johnson
On Fri, Nov 7, 2008 at 6:16 PM, Alan Gauld [EMAIL PROTECTED] wrote: True, but its pretty rare that timing issues are a reason for me to choose a data structure I would guess you commonly choose a dict or set over a list when you need fast tests for membership. Failure to choose dict when

[Tutor] cgi scripts

2008-11-07 Thread Jim Morcombe
I want to print a list of the keys and their values passed to a cgi script by an HTML form. I have tried this, but just seems to crash. Any ideas? Jim Morcombe #!C:\python25\python.exe import cgi, sys # import cgitb; cgitb.enable() #Send errors to browser sys.stderr = sys.stdout #Parse

Re: [Tutor] cgi scripts

2008-11-07 Thread Steve Willoughby
Jim Morcombe wrote: I want to print a list of the keys and their values passed to a cgi script by an HTML form. I have tried this, but just seems to crash. When you say crash, what do you mean, exactly? Any ideas? print Content-type: text/html\n print titleCGI Form Response/title\n print