我正在按照设置开发环境的说明进行操作,该开发环境可以在Professional Plone 4 Development一书的开头找到。我采取了以下步骤。
首先,我创建了一个名为pln
的virtualenv和一个名为pln
的项目目录
其次,我将PIL安装到pln
virtualenv。
第三,我创建了一个buildout.cfg
文件,其中包含以下内容:
[buildout]
extends = http://dist.plone.org/release/4.2/versions.cfg
parts = instance
[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
eggs = Plone
第四,我从http://svn.plone.org/svn/plone/buildouts/plone-coredev/branches/4.2/bootstrap.py
下载了bootstrap.py
第五,我运行了命令python bootstrap.py --distribute
,它提供了以下输出:
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.29.tar.gz
Extracting in /var/folders/xk/5xt9s5vd4bqd731qdkmxkxyr0000gn/T/tmpwMBNe9
Now working in /var/folders/xk/5xt9s5vd4bqd731qdkmxkxyr0000gn/T/tmpwMBNe9/distribute-0.6.29
Building a Distribute egg in /var/folders/xk/5xt9s5vd4bqd731qdkmxkxyr0000gn/T/tmpKSPdWX
/var/folders/xk/5xt9s5vd4bqd731qdkmxkxyr0000gn/T/tmpKSPdWX/distribute-0.6.29-py2.7.egg
Creating directory '/Users/Jon/dev/pln/bin'.
Creating directory '/Users/Jon/dev/pln/parts'.
Creating directory '/Users/Jon/dev/pln/eggs'.
Creating directory '/Users/Jon/dev/pln/develop-eggs'.
Generated script '/Users/Jon/dev/pln/bin/buildout'.
第六,从项目目录中我运行了命令bin/buildout
。一切似乎都可以正常工作,但后来我开始收到类似下面的大量错误消息:
SyntaxError: ("'return' outside function", ('build/bdist.macosx-10.8-x86_64/egg/Products/kupu/plone/kupu_plone_layer/convertContentForKupu.py', 23, None, 'return str(content)\n'))
SyntaxError: ("'return' outside function", ('/Users/Jon/dev/pln/eggs/tmpEwAZSu/Products.CMFPlone-4.2.0.1-py2.7.egg/Products/CMFPlone/skins/plone_scripts/redirectToReferrer.py', 18, None, 'return request.RESPONSE.redirect(target_url)\n'))
SyntaxError: ("'return' outside function", ('build/bdist.macosx-10.8-x86_64/egg/Products/Archetypes/skins/archetypes/unicodeTestIn.py', 11, None, 'return 0\n'))
最后,运行bin/buildout
失败并显示以下错误:
While: Installing instance.
Getting distribution for 'plone.outputfilters==1.3'.
An internal error occured due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/Users/Jon/dev/pln/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 1683, in main
getattr(buildout, command)(args)
File "/Users/Jon/dev/pln/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 555, in install
installed_files = self[part]._call(recipe.install)
[about 50 lines of stack trace admitted for brevity...]
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 365, in _read_status
line = self.fp.readline()
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 54] Connection reset by peer
为什么对端在那里重置连接?这是哪个同行,我怎样才能控制这样的错误?
非常感谢您的帮助。
答案 0 :(得分:1)
从“专业Plone 4开发”一书中我得到了为什么我会遇到语法错误的答案:
您可能还会看到一些关于“语法错误”的警告 Setuptools / Distribute尝试预编译某些Python脚本。您 可以安全地忽略这些。发布它们是因为,这些脚本是 不是普通的Python模块,而是用于执行的脚本 在Zope的不受信任的脚本环境中。
- Aspeli,Martin(2011-08-26)。专业Plone 4发展(第38页)。 Packt Publishing。 Kindle版。
然而,我仍然不确定bin/buildout
失败的原因。我刚刚尝试了一切新鲜事,我得到了这个错误:
While: Installing. Getting section instance. Initializing section instance. Installing recipe plone.recipe.zope2instance. Getting distribution for 'docutils==0.9.1'. An internal error occured due to a bug in either zc.buildout or in a recipe being used: Traceback (most recent call last): File "/Users/Jon/dev/pl/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 1683, in main getattr(buildout, command)(args) File "/Users/Jon/dev/pl/eggs/zc.buildout-1.4.4-py2.7.egg/zc/buildout/buildout.py", line 439, in install [self[part]['recipe'] for part in install_parts] ** 50 OR SO LINES OF STACK TRACE OMITTED FOR BREVITY ** File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 365, in _read_status line = self.fp.readline() File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 447, in readline data = self._sock.recv(self._rbufsize) timeout: timed out编辑:好的,我已经发现整个事情都不适用于Plone 4.2。只需将所有内容设为4.1,
bin/buildout
将完成而不会崩溃。
答案 1 :(得分:0)
在我看来,你正在使用你的系统python而不是你的virtualenv python。你使用virtualenv python来引导你的buildout吗?
您刚才提到过运行“python bootstrap.py”。因此,除非您运行“source MyVirtualEnvDir / bin / activate”,否则您调用了系统python。如果你使用pip或easyinstall在你的系统python中安装了模块,那么这些模块中的一些可能会与你的buildout冲突并导致一些奇怪的错误。
BTW,正如其他人所指出的,超时也可能是由服务器或网络错误引起的。您不能只使用统一安装程序的任何原因?它是最容易使用的,您仍然可以使用它来尝试Martin的书中提出的活动。