Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparse "invalid syntax" error. Python 3.4 / virtualenv #172

Closed
marianov opened this issue Aug 27, 2015 · 5 comments
Closed

sparse "invalid syntax" error. Python 3.4 / virtualenv #172

marianov opened this issue Aug 27, 2015 · 5 comments

Comments

@marianov
Copy link

In OSX, installed python3 (3.4), created a virtualenv, installed sreamparse, and whenever it runs it show "invalid syntax" error.

(streamparse)[mariano:/W-IOT/pruebas-plataformas/streamparse]$ virtualenv --version
1.11.6
(streamparse)[mariano:
/W-IOT/pruebas-plataformas/streamparse]$ python --version
Python 3.4.3
(streamparse)[mariano:/W-IOT/pruebas-plataformas/streamparse]$ pip --version
pip 1.5.6 from /Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages (python 3.4)
(streamparse)[mariano:
/W-IOT/pruebas-plataformas/streamparse]$ sparse
Traceback (most recent call last):
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/bin/sparse", line 9, in
load_entry_point('streamparse==2.0.2', 'console_scripts', 'sparse')()
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/streamparse/cli/sparse.py", line 47, in main
load_suparsers(subparsers)
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/streamparse/cli/sparse.py", line 25, in load_suparsers
module = importlib.import_module('streamparse.cli.{}'.format(mod_name))
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/importlib/init.py", line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 2254, in _gcd_import
File "", line 2237, in _find_and_load
File "", line 2226, in _find_and_load_unlocked
File "", line 1200, in _load_unlocked
File "", line 1129, in _exec
File "", line 1471, in exec_module
File "", line 321, in _call_with_frames_removed
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/streamparse/cli/jar.py", line 12, in
from ..util import prepare_topology
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/streamparse/util.py", line 12, in
from fabric.api import env
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/fabric/api.py", line 9, in
from fabric.context_managers import (cd, hide, settings, show, path, prefix,
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/fabric/context_managers.py", line 535
def accept(channel, (src_addr, src_port), (dest_addr, dest_port)):
^
SyntaxError: invalid syntax

When installing streamparse there where similar errors:

*** Error compiling '/Users/mariano/W-IOT/pruebas-plataformas/streamparse/build/invoke/invoke/vendor/yaml2/resolver.py'...
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/build/invoke/invoke/vendor/yaml2/resolver.py", line 171
re.compile(ur'''^(?:yes|Yes|YES|no|No|NO
|true|True|TRUE|false|False|FALSE
|on|On|ON|off|Off|OFF)$''', re.X),

                                         ^

SyntaxError: invalid syntax

*** Error compiling '/Users/mariano/W-IOT/pruebas-plataformas/streamparse/build/invoke/invoke/vendor/yaml2/scanner.py'...
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/build/invoke/invoke/vendor/yaml2/scanner.py", line 1427
except UnicodeDecodeError, exc:
^
SyntaxError: invalid syntax

Running setup.py install for fabric
File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/fabric/context_managers.py", line 535
def accept(channel, (src_addr, src_port), (dest_addr, dest_port)):
^
SyntaxError: invalid syntax

  File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/fabric/network.py", line 25
    except ImportError, e:
                      ^
SyntaxError: invalid syntax

  File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/fabric/operations.py", line 224
    except Exception, e:
                    ^
SyntaxError: invalid syntax

  File "/Users/mariano/W-IOT/pruebas-plataformas/streamparse/lib/python3.4/site-packages/fabric/sftp.py", line 85
    except Exception, err:
                    ^
SyntaxError: invalid syntax

The FAQ says it should work with Python > 3.3

Don't know if this is a user error or a bug.

@dan-blanchard
Copy link
Member

Duplicate of #76 and #170. You just need to install the Python 3 compatible fork of fabric in our requirements.txt.

@grvhi
Copy link

grvhi commented Mar 30, 2016

Apologies for opening an old issue, but having run pip install fabric3, I get the following error when trying to run sparse quickstart word count

  File "/Users/george/sites/venv/bin/sparse", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/Users/george/sites/venv/lib/python3.5/site-packages/pkg_resources.py", line 2716, in <module>
    working_set.require(__requires__)
  File "/Users/george/sites/venv/lib/python3.5/site-packages/pkg_resources.py", line 685, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/Users/george/sites/venv/lib/python3.5/site-packages/pkg_resources.py", line 588, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: fabric

It would seem that sparse is looking for fabric, while Fabric3 installs as fabric3.....?

@dan-blanchard
Copy link
Member

@Erve1879, yeah, that is unfortunately an issue in the version of streamparse you're using. Both of the 3.0 developer preview releases do not have this issue anymore.

@dan-blanchard
Copy link
Member

You can see more info about the new releases here.

@grvhi
Copy link

grvhi commented Mar 30, 2016

Thanks for the quick response @dan-blanchard - since this is my first stab-at-streamparse, I'll start with the dev release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants