Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with SQLAlchemy and VirtualEnv
    text
    copied!<p>I'm trying to use SQLAlchemy under a virtualenv on OS X 10.5, but cannot seem to get it to load whatsoever.</p> <p>Here's what I've done</p> <pre><code>mkvirtualenv --no-site-packages test easy_install sqlalchemy </code></pre> <p>I try to import sqlalchemy from the interpreter and everything works fine, but if i try to import sqlalchemy from a python script, I get the following error:</p> <p>Here's the tutorial script from <a href="http://www.ibm.com/developerworks/aix/library/au-sqlalchemy/" rel="nofollow noreferrer">IBM</a></p> <pre><code>from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey Base = declarative_base() class Filesystem(Base): __tablename__ = 'filesystem' path = Column(String, primary_key=True) name = Column(String) def __init__(self, path,name): self.path = path self.name = name def __repr__(self): return "&lt;Metadata('%s','%s')&gt;" % (self.path,self.name) </code></pre> <p>I try running 'python test.py' and this is the result:</p> <pre><code>$ python test.py Traceback (most recent call last): File "test.py", line 4, in &lt;module&gt; from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey File "/Users/grant/Development/Aircraft/sqlalchemy.py", line 3, in &lt;module&gt; from sqlalchemy.ext.declarative import declarative_base ImportError: No module named ext.declarative </code></pre> <p>Here's what's in my sys.path</p> <pre><code>&gt;&gt;&gt; import sys &gt;&gt;&gt; print '\n'.join(sys.path) /Users/grant/Development/Python/test/lib/python2.6/site-packages/setuptools-0.6c9-py2.6.egg /Users/grant/Development/Python/test/lib/python2.6/site-packages/SQLAlchemy-0.5.4p2-py2.6.egg /Users/grant/Development/Python/test/lib/python26.zip /Users/grant/Development/Python/test/lib/python2.6 /Users/grant/Development/Python/test/lib/python2.6/plat-darwin /Users/grant/Development/Python/test/lib/python2.6/plat-mac /Users/grant/Development/Python/test/lib/python2.6/plat-mac/lib-scriptpackages /Users/grant/Development/Python/test/lib/python2.6/lib-tk /Users/grant/Development/Python/test/lib/python2.6/lib-old /Users/grant/Development/Python/test/lib/python2.6/lib-dynload /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6 /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages /Users/grant/Development/Python/test/lib/python2.6/site-packages </code></pre> <p>Any ideas on what's going on??</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload