Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 5:13 PM, wrote: > On Sun, 27 Jun 2010 15:56:23 -0700 > Marc Tompkins wrote: > >> On Sun, Jun 27, 2010 at 3:20 PM, wrote: >> >> I don't have any insight into your other piece of code, but here I think >> you >> just need another set of parentheses - so that the string in

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread petkovas
On Sun, 27 Jun 2010 15:56:23 -0700 Marc Tompkins wrote: On Sun, Jun 27, 2010 at 3:20 PM, wrote: I don't have any insight into your other piece of code, but here I think you just need another set of parentheses - so that the string interpolation is done first, and the result

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Steven D'Aprano
On Mon, 28 Jun 2010 08:20:01 am petko...@dir.bg wrote: > The full error message is: > > Traceback : > File "insert_into_db_v9.py", line 55, in >WHERE testtable_n = %s""", data1, > str(os.path.splitext(file)[0])) > TypeError: an integer is required Unfortunately this isn't helpful, be

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 3:20 PM, wrote: > I have tried the following, too: > > from pg8000 import DBAPI > import os > import os.path > import sys > > # !!! that is test data. It must be changed > conn=DBAPI.connect(host="localhost", database="postgres", user="postgres", > password="test") > > #co

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread petkovas
Can you send the full error text please? I'm not sure which is line 55 and Python normally displays the faulty line as part of the error trace. As it is I can't see any reason for it to fail but I'd like to be sure I'm looking at the right place! Also is there any reason why you explicitly c

Re: [Tutor] TypeError when io.open is used

2010-06-24 Thread Alan Gauld
wrote The error: Traceback : File "insert_into_db_v9.py", line 55, in TypeError: an integer is required Can you send the full error text please? I'm not sure which is line 55 and Python normally displays the faulty line as part of the error trace. As it is I can't see any reason for i

[Tutor] TypeError when io.open is used

2010-06-23 Thread petkovas
Hello all! I would like to ask you the following: what should i do to be executed my correctly? The error: Traceback : File "insert_into_db_v9.py", line 55, in TypeError: an integer is required The code i use is the following: import psycopg2 import os from os import sep, listdir, path im