tadasajon
tadasajon

Reputation: 14856

I ran bin/buildout to install Plone and got dozens of syntax errors, then failure -- but why?

I'm following the instructions for setting up a development environment which can be found at the beginning of the book Professional Plone 4 Development. I took the following steps.

First, I created a virtualenv called pln and a project directory also called pln

Second, I installed PIL into the pln virtualenv.

Third, I created a buildout.cfg file with the following contents:

[buildout]
extends = http://dist.plone.org/release/4.2/versions.cfg
parts = instance
[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
eggs = Plone

Fourth, I downloaded bootstrap.py from http://svn.plone.org/svn/plone/buildouts/plone-coredev/branches/4.2/bootstrap.py

Fifth, I ran the command python bootstrap.py --distribute, which gave the following output:

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'.

Sixth, from the project directory I ran the command bin/buildout. Everything seemed to work okay for a while, but then I began getting scores of error messages similar to these below:

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'))

Finally, running bin/buildout fails with the following error:

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

Why is the connection reset by the peer at the end there? Which peer is this, and how can I have any control over an error like this?

Thanks much, in advance, for your help.

Upvotes: 1

Views: 832

Answers (2)

h2o
h2o

Reputation: 513

It seems to me that you are using your system python instead of your virtualenv python. Did you use your virtualenv python to bootstrap your buildout?

You just mentioned running "python bootstrap.py". So unless you ran "source MyVirtualEnvDir/bin/activate", you invoked your system python. If you have installed modules in your system python using pip or easyinstall, then some of these modules may conflict with your buildout and cause some weird errors.

BTW, as pointed out by others, the timeout could also be caused by server or network errors.

Any reason why you can not just use the unified installer? It is the easiest to use and you can still use it to try out activities suggested by Martin's book.

Upvotes: 0

tadasajon
tadasajon

Reputation: 14856

From the book "Professional Plone 4 Development" I have the answer to why I am getting syntax errors:

You may also see some warnings about 'syntax errors' fly past when Setuptools/Distribute tries to pre-compile certain Python scripts. You can safely ignore these. They are issued because, these scripts are not normal Python modules, but rather scripts intended to be executed in Zope's untrusted scripting environment.

  • Aspeli, Martin (2011-08-26). Professional Plone 4 Development (p. 38). Packt Publishing. Kindle Edition.

I'm still not sure why bin/buildout fails, however. I just tried again with everything fresh and I got this error:

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

EDIT: Okay, I've figured out that the whole thing just doesn't work with Plone 4.2. Just make everything 4.1 instead and it will bin/buildout will finish without crashing.

Upvotes: 1

Related Questions