fabric error

Hello, trying to build from source code, i end up with the following error:

File “/usr/lib/python2.6/site-packages/Fabric-1.8.2-py2.6.egg/fabric/main.py”,
line 658, in main
docstring, callables, default = load_fabfile(fabfile)
File “/usr/lib/python2.6/site-packages/Fabric-1.8.2-py2.6.egg/fabric/main.py”,
line 165, in load_fabfile
imported = importer(os.path.splitext(fabfile)[0])
File “/mydir/fabfile.py”, line 505
with cd(env.VENDOR_PATH), settings(warn_only=True):
SyntaxError: invalid syntax

i’m centos 6.4 default pyton version is 2.6.6

An idea?

1 Like

That code requires Python 2.7.

Perhaps you can import from __future__ to get ‘with’.

It’s actually the multiple-argument ‘with’ that was added in 2.7; you could change it to “with cd(…): with settings(…):” but I imagine you have some other 2.7-isms in NewsBlur, which is why I suggested just getting a newer version…


Well thank you guys for your help, Nicholas i’ve change my python version to 2.7, and you were right, that removed the splitext error, however i have a new error importing boto connection:

File “/usr/local/lib/python2.7/site-packages/fabric/main.py”, line 658, in mai
docstring, callables, default = load_fabfile(fabfile)
File “/usr/local/lib/python2.7/site-packages/fabric/main.py”, line 165, in loa
imported = importer(os.path.splitext(fabfile)[0])
File “/newsapps/fabfile.py”, line 5, in
from boto.s3.connection import S3Connection
ImportError: No module named boto.s3.connection

I’m sure i have boto installed:

Setting up Install Process
Package python-boto-2.25.0-2.el6.noarch already installed and latest version
Nothing to do

I know that this is may not be the correct place to ask about this issue, i’m googling around linux forums, but appreciate if you can help me.

Thank you guys

That package is a version of boto for Python 2.6. You might try either (a) a distribution that has Python 2.7 as its default Python, or (b) using native Python packaging, i.e., pip, instead of RPMs.

well thank you again Nicholas, pip -intsall -U boto fixed that

but now i’m stuck on other issues, here is my out:

fab -H localhost setup_all

Digital Ocean’s API not loaded
***> No role definitions found in /srv/secrets-newsblur/configs/hosts.yml. Usin
g default roles.
—> You need to fix django’s settings. Enter python and type ‘import settings’
[localhost] Executing task ‘setup_all’
[localhost] sudo: apt-get -y update
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/fabric/main.py”, line 743, in mai
*args, **kwargs
File “/usr/local/lib/python2.7/site-packages/fabric/tasks.py”, line 368, in ex
File “/usr/local/lib/python2.7/site-packages/fabric/tasks.py”, line 264, in _e
return task.run(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/fabric/tasks.py”, line 171, in ru
return self.wrapped(*args, **kwargs)
File “/newsapps/fabfile.py”, line 211, in setup_all
File “/newsapps/fabfile.py”, line 186, in setup_common
File “/newsapps/fabfile.py”, line 330, in setup_installs
sudo(‘apt-get -y update’)
File “/usr/local/lib/python2.7/site-packages/fabric/network.py”, line 639, in
return func(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/fabric/operations.py”, line 1095,
in sudo
stderr=stderr, timeout=timeout, shell_escape=shell_escape,
File “/usr/local/lib/python2.7/site-packages/fabric/operations.py”, line 909,
in _run_command
channel=default_channel(), command=wrapped_command, pty=pty,
File “/usr/local/lib/python2.7/site-packages/fabric/state.py”, line 388, in de
chan = _open_session()
File “/usr/local/lib/python2.7/site-packages/fabric/state.py”, line 380, in _o
return connections[env.host_string].get_transport().open_session()
File “/usr/local/lib/python2.7/site-packages/fabric/network.py”, line 151, in
File “/usr/local/lib/python2.7/site-packages/fabric/network.py”, line 143, in
self[key] = connect(user, host, port, cache=self)
File “/usr/local/lib/python2.7/site-packages/fabric/network.py”, line 444, in
File “/usr/local/lib/python2.7/site-packages/paramiko/client.py”, line 342, in
self._auth(username, password, pkey, key_filenames, allow_agent, look_for_ke
File “/usr/local/lib/python2.7/site-packages/paramiko/client.py”, line 462, in
key = pkey_class.from_private_key_file(key_filename, password)
File “/usr/local/lib/python2.7/site-packages/paramiko/pkey.py”, line 198, in f
key = cls(filename=filename, password=password)
File “/usr/local/lib/python2.7/site-packages/paramiko/rsakey.py”, line 51, in
self._from_private_key_file(filename, password)
File “/usr/local/lib/python2.7/site-packages/paramiko/rsakey.py”, line 163, in
data = self._read_private_key_file(‘RSA’, filename, password)
File “/usr/local/lib/python2.7/site-packages/paramiko/pkey.py”, line 279, in _
f = open(filename, ‘r’)
IOError: [Errno 2] No such file or directory: ‘/srv/secrets-newsblur/keys/newsbl

is their any guide for walking through fabfile for linux installation?

thanks again

You’ll want to find a “newsblur secrets skeleton” and place that in /srv/secrets-newsblur

thank you Samuel, but where can i find that :slight_smile: ?
If i succeeded with building from source, i will write a full guide about the process.