Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2296 (closed defect: migrated)

Opened 10 years ago

Last modified 8 years ago

sqlite db creation error in wiki20 tutorial

Reported by: xpixelz Owned by:
Priority: normal Milestone: 2.1 docs
Component: TurboGears Version: 2.0b7
Severity: normal Keywords:
Cc: sqlite, sqlite3, database, wiki, wiki20, wiki-20, tutorial

Description

when initializing database with paster setup-app development.ini in the section Initialize the Database Table from the wiki tutorial at  http://turbogears.org/2.0/docs/main/Wiki20/page4.html I get this error "Cannot operate on a closed cursor"

The solution was, in "wiki20/websetup.py", substituting this line model.metadata.create_all(bind=configpylons.app_globals?.sa_engine) by this one model.metadata.create_all(bind=configpylons.app_globals?.sa_engine, checkfirst=False)

Change History

comment:1 Changed 10 years ago by jorge.vargas

  • Milestone set to 2.1a1

Could you please provide your platform information and a way to reproduce this bug. A traceback will be nice.

comment:2 Changed 10 years ago by Twey

To reproduce:

1) Quickstart a project. 2) Edit the models to create a table with DeclarativeBase? as described in the tutorial. 3) Run paster setup-app development.ini.

Trace:

(tg2env)[@ twey peordh ] % paster setup-app development.ini % [P ~/Development/Web?/tcc/turbo/twey.co.uk ] [J 3 ] [L 772 ] /home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/tw/core/view.py:202: DeprecationWarning?: object.new() takes no parameters

obj = object.new(cls, *args, kw)

/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/peak/rules/indexing.py:220: DeprecationWarning?: object.new() takes no parameters

return super(BitmapIndex?, cls).new(cls, engine, expr)

Running setup_config() from tcc.websetup Creating tables 06:59:30,506 INFO [sqlalchemy.engine.base.Engine.0x...7610] PRAGMA table_info("pages") 06:59:30,510 INFO [sqlalchemy.engine.base.Engine.0x...7610] () 06:59:30,511 INFO [sqlalchemy.engine.base.Engine.0x...7610] ROLLBACK Traceback (most recent call last):

File "/home/twey/Development/Web/tcc/turbo/tg2env/bin/paster", line 8, in <module>

load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/paste/script/command.py", line 84, in run

invoke(command, command_name, options, args[1:])

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/paste/script/command.py", line 123, in invoke

exit_code = runner.run(args)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/paste/script/appinstall.py", line 68, in run

return super(AbstractInstallCommand?, self).run(new_args)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/paste/script/command.py", line 218, in run

result = self.command()

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/paste/script/appinstall.py", line 456, in command

self, config_file, section, self.sysconfig_install_vars(installer))

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/paste/script/appinstall.py", line 598, in setup_config

mod.setup_app, command, filename, section, vars)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/paste/script/appinstall.py", line 612, in _call_setup_app

func(command, conf, vars)

File "/home/twey/Development/Web/tcc/turbo/twey.co.uk/tcc/websetup.py", line 22, in setup_app

model.metadata.create_all(bind=configpylons.app_globals?.sa_engine)#, checkfirst=False)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/schema.py", line 1765, in create_all

bind.create(self, checkfirst=checkfirst, tables=tables)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/engine/base.py", line 1129, in create

self._run_visitor(self.dialect.schemagenerator, entity, connection=connection, kwargs)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/engine/base.py", line 1158, in _run_visitor

visitorcallable(self.dialect, conn, kwargs).traverse(element)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/sql/visitors.py", line 89, in traverse

return traverse(obj, self.traverse_options, self._visitor_dict)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/sql/visitors.py", line 200, in traverse

return traverse_using(iterate(obj, opts), obj, visitors)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/sql/visitors.py", line 194, in traverse_using

meth(target)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/sql/compiler.py", line 795, in visit_metadata

collection = [t for t in sql_util.sort_tables(tables) if self._can_create(t)]

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/sql/compiler.py", line 788, in _can_create

return not self.checkfirst or not self.dialect.has_table(self.connection, table.name, schema=table.schema)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/databases/sqlite.py", line 443, in has_table

row = cursor.fetchone()

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/engine/base.py", line 1668, in fetchone

self.connection._handle_dbapi_exception(e, None, None, self.cursor, self.context)

File "/home/twey/Development/Web/tcc/turbo/tg2env/lib/python2.6/site-packages/SQLAlchemy-0.5.2-py2.6.egg/sqlalchemy/engine/base.py", line 931, in _handle_dbapi_exception

raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect)

sqlalchemy.exc.ProgrammingError?: (ProgrammingError?) Cannot operate on a closed cursor. None None

Platform information: Linux peordh 2.6.30-ARCH #1 SMP PREEMPT Fri Jul 31 07:30:28 CEST 2009 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ AuthenticAMD GNU/Linux

comment:3 Changed 10 years ago by percious

  • Milestone changed from 2.1a1 to 2.1 docs

comment:4 Changed 8 years ago by pedersen

  • Status changed from new to closed
  • Resolution set to migrated
Note: See TracTickets for help on using tickets.