On Mar 2, 9:31 am, Chris McDonough <[email protected]> wrote:
> On Tue, 2011-03-01 at 23:21 -0800, Eric wrote:
> > config.scan() problem
>
> > Hi all,
> > Just starting to work with Pyramid, followed the tutorial to get a
> > basic site running. Then I grabbed some files from a TG2.1 app I had
> > been working on and dropped them into the Pyramid app directory for
> > future use (Win 7, latest Pyramid, Py 2.6.6). The next time I
> > restarted and refreshed the root I got an error from SQLAlchemy
> > (running in debug mode in Wing Pro). I traced it back to an old model
> > file that I had dropped in from the TG2.1 app. Seems that something
> > goes wrong (I'm pretty new at all of this...) during the scan?
>
> Specifics of your error aside (I'm not sure why code would be trying to
> construct a model instance at module scope, and it's really mostly
> unrelated), the scan process will recursively import every Python module
> and package under a given directory. If you had the following package:
>
> foo--
> |
> |-- __init__.py
> |
> bar--
> |
> |-- __init__.py
> |
> |--- tests.py
>
> running scan('foo') would have approximately the effect of:
>
> import foo
> import foo.bar
> import foo.bar.tests
>
> There is no good way right now to tell it to ignore a package or module
> (although it will ignore non-package directories). A feature to do so
> has been requested, although so far folks have gotten a very long way by
> just doing fewer insane things at module scope, so it hasn't really been
> a priority.
>
> - C
>
Hi,
The file is a TG2.1 model file that at one time was working but got
left in an intermediate state when I stopped having time to play with
TG. All that is at the module level are normal SQLAlchemy imports
plus I imported Base from the tutorial model file, a bunch of many-to-
many relation tables:
parts_has_datasheets_table = Table('parts_has_datasheets',
Base.metadata,
Column('parts_id', Integer,
ForeignKey('parts.parts_id'), primary_key=True),
Column('datasheets_id', Integer,
ForeignKey('datasheets.datasheets_id'), primary_key=True))
Then there are 21 classes for tables. It has been several months
since I worked with SQLAlchemy so I have to do some relearning but I
think I see an error in one of the classes that seems to correlate to
the error message. Just seems strange that it would break a query
against a different table in another file.
Thanks
Eric
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.