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?
Regards

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…

http://docs.python.org/dev/whatsnew/2…

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
n
docstring, callables, default = load_fabfile(fabfile)
File “/usr/local/lib/python2.7/site-packages/fabric/main.py”, line 165, in loa
d_fabfile
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
n
*args, **kwargs
File “/usr/local/lib/python2.7/site-packages/fabric/tasks.py”, line 368, in ex
ecute
multiprocessing
File “/usr/local/lib/python2.7/site-packages/fabric/tasks.py”, line 264, in _e
xecute
return task.run(*args, **kwargs)
File “/usr/local/lib/python2.7/site-packages/fabric/tasks.py”, line 171, in ru
n
return self.wrapped(*args, **kwargs)
File “/newsapps/fabfile.py”, line 211, in setup_all
setup_common()
File “/newsapps/fabfile.py”, line 186, in setup_common
setup_installs()
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
host_prompting_wrapper
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
fault_channel
chan = _open_session()
File “/usr/local/lib/python2.7/site-packages/fabric/state.py”, line 380, in _o
pen_session
return connections[env.host_string].get_transport().open_session()
File “/usr/local/lib/python2.7/site-packages/fabric/network.py”, line 151, in
__getitem__
self.connect(key)
File “/usr/local/lib/python2.7/site-packages/fabric/network.py”, line 143, in
connect
self[key] = connect(user, host, port, cache=self)
File “/usr/local/lib/python2.7/site-packages/fabric/network.py”, line 444, in
connect
sock=sock
File “/usr/local/lib/python2.7/site-packages/paramiko/client.py”, line 342, in
connect
self._auth(username, password, pkey, key_filenames, allow_agent, look_for_ke
ys)
File “/usr/local/lib/python2.7/site-packages/paramiko/client.py”, line 462, in
_auth
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
rom_private_key_file
key = cls(filename=filename, password=password)
File “/usr/local/lib/python2.7/site-packages/paramiko/rsakey.py”, line 51, in
__init__
self._from_private_key_file(filename, password)
File “/usr/local/lib/python2.7/site-packages/paramiko/rsakey.py”, line 163, in
_from_private_key_file
data = self._read_private_key_file(‘RSA’, filename, password)
File “/usr/local/lib/python2.7/site-packages/paramiko/pkey.py”, line 279, in _
read_private_key_file
f = open(filename, ‘r’)
IOError: [Errno 2] No such file or directory: ‘/srv/secrets-newsblur/keys/newsbl
ur.key’

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.