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

Syntax Error shown by Flake8 #124

Closed
mansimarkaur opened this issue Feb 22, 2017 · 27 comments
Closed

Syntax Error shown by Flake8 #124

mansimarkaur opened this issue Feb 22, 2017 · 27 comments
Labels

Comments

@mansimarkaur
Copy link
Contributor

I just cloned the repo and run the tests and flake8 is failing on https://github.com/pimutils/todoman/blob/master/todoman/model.py#L476
My terminal shows the following:

flake8 installed: appdirs==1.4.0,configparser==3.5.0,enum34==1.1.6,flake8==3.3.0,flake8-import-order==0.12,mccabe==0.6.1,packaging==16.8,pycodestyle==2.3.1,pyflakes==1.5.0,pyparsing==2.1.10,six==1.10.0,todoman==2.1.0.post13+ng96016ff
flake8 runtests: PYTHONHASHSEED='2330703630'
flake8 runtests: commands[0] | flake8
./todoman/model.py:476:42: E999 SyntaxError: invalid syntax
ERROR: InvocationError: '/Users/mkaur/Sites/todoman/.tox/flake8/bin/flake8'
@WhyNotHugo
Copy link
Member

Hi! Can you please provide the output of python --version? I suspect you're using python2; todoman only support python3 (note that both can be installed at the same time).

@mansimarkaur
Copy link
Contributor Author

mansimarkaur commented Feb 22, 2017

Yes, python --version returned Python 2.7.13
I installed python 3 and am now using a virtualenv.
I get these errors:

SKIPPED:  py33: InterpreterNotFound: python3.3
SKIPPED:  py34: InterpreterNotFound: python3.4
SKIPPED:  py35: InterpreterNotFound: python3.5
ERROR:   py36: InvocationError: /Users/mkaur/Sites/todoman/.tox/py36/bin/pip install /Users/mkaur/Sites/todoman/.tox/dist/todoman-2.1.0.post13+ng96016ff.d20170223.zip (see /Users/mkaur/Sites/todoman/.tox/py36/log/py36-2.log)
ERROR:   flake8: commands failed
  docs: commands succeeded
(env_name) mkaur-30825:todoman mkaur$ python --version
Python 3.6.0

@untitaker
Copy link
Member

Hmm.

  • tox -epy36 should run the tests
  • tox -eflake8 should run flake8

The output isn't very informative of flake8, but there's talk of a logfile called Users/mkaur/Sites/todoman/.tox/py36/log/py36-2.log. Could you post that file?

@mansimarkaur
Copy link
Contributor Author

Users/mkaur/Sites/todoman/.tox/py36/log/py36-2.log:

actionid: py36
msg: installpkg
cmdargs: ['/Users/mkaur/Sites/todoman/.tox/py36/bin/pip', 'install', '/Users/mkaur/Sites/todoman/.tox/dist/todoman-2.1.0.post13+ng96016ff.d20170223.zip']
env: {'LC_CTYPE': 'UTF-8', 'TERM_PROGRAM_VERSION': '361.1', 'LOGNAME': 'mkaur', 'USER': 'mkaur', 'PATH': '/Users/mkaur/Sites/todoman/.tox/py36/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin/env_name/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/mkaur/.rbenv/shims:/Users/mkaur/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin', 'HOME': '/Users/mkaur', 'PS1': '(env_name) \\h:\\W \\u\\$ ', 'TERM_PROGRAM': 'Apple_Terminal', 'LANG': 'en_US.UTF-8', 'TERM': 'xterm-256color', 'Apple_PubSub_Socket_Render': '/private/tmp/com.apple.launchd.4vaaXg3BoA/Render', 'SHLVL': '1', 'XPC_FLAGS': '0x0', 'RBENV_SHELL': 'bash', 'PYTHONHASHSEED': '2388422466', '_': '/usr/local/bin/tox', 'TERM_SESSION_ID': '123E97E0-2737-4586-80F4-94FE37C0E6B5', 'XPC_SERVICE_NAME': '0', 'PYTHONPATH': '/Users/mkaur/Sites/todoman', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.IkckKUmxeV/Listeners', 'VIRTUAL_ENV': '/Users/mkaur/Sites/todoman/.tox/py36', 'SHELL': '/bin/bash', 'LC_ALL': 'en_US.UTF-8', 'TMPDIR': '/var/folders/3j/xz5kwgvx297_45dgm2bgpr0h0000gn/T/', 'OLDPWD': '/Users/mkaur', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'PWD': '/Users/mkaur/sites/todoman'}

Processing ./.tox/dist/todoman-2.1.0.post13+ng96016ff.d20170223.zip
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/pytest-runner/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
    Couldn't find index page for 'pytest-runner' (maybe misspelled?)
    Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!
    No local packages or working download links found for pytest-runner
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/3j/xz5kwgvx297_45dgm2bgpr0h0000gn/T/pip-cc62cbhs-build/setup.py", line 41, in <module>
        'Topic :: Utilities',
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/Users/mkaur/Sites/todoman/.tox/py36/lib/python3.6/site-packages/setuptools/dist.py", line 317, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/Users/mkaur/Sites/todoman/.tox/py36/lib/python3.6/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
        replace_conflicting=True,
      File "/Users/mkaur/Sites/todoman/.tox/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 851, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/Users/mkaur/Sites/todoman/.tox/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1123, in best_match
        return self.obtain(req, installer)
      File "/Users/mkaur/Sites/todoman/.tox/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1135, in obtain
        return installer(requirement)
      File "/Users/mkaur/Sites/todoman/.tox/py36/lib/python3.6/site-packages/setuptools/dist.py", line 440, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Users/mkaur/Sites/todoman/.tox/py36/lib/python3.6/site-packages/setuptools/command/easy_install.py", line 668, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('pytest-runner')
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3j/xz5kwgvx297_45dgm2bgpr0h0000gn/T/pip-cc62cbhs-build/

@mansimarkaur
Copy link
Contributor Author

I pip installed pytest-runner
Now, the log file is as follows:

actionid: py36
msg: envreport
cmdargs: ['/Users/mkaur/Sites/todoman/.tox/py36/bin/pip', 'freeze']
env: {'LC_CTYPE': 'UTF-8', 'TERM_PROGRAM_VERSION': '361.1', 'LOGNAME': 'mkaur', 'USER': 'mkaur', 'PATH': '/Users/mkaur/Sites/todoman/.tox/py36/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin/env_name/bin:/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/mkaur/.rbenv/shims:/Users/mkaur/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin', 'HOME': '/Users/mkaur', 'PS1': '(env_name) \\h:\\W \\u\\$ ', 'TERM_PROGRAM': 'Apple_Terminal', 'LANG': 'en_US.UTF-8', 'TERM': 'xterm-256color', 'Apple_PubSub_Socket_Render': '/private/tmp/com.apple.launchd.4vaaXg3BoA/Render', 'SHLVL': '1', 'XPC_FLAGS': '0x0', 'RBENV_SHELL': 'bash', 'PYTHONHASHSEED': '1278482248', '_': '/usr/local/bin/tox', 'TERM_SESSION_ID': '123E97E0-2737-4586-80F4-94FE37C0E6B5', 'XPC_SERVICE_NAME': '0', 'PYTHONPATH': '/Users/mkaur/Sites/todoman', 'SSH_AUTH_SOCK': '/private/tmp/com.apple.launchd.IkckKUmxeV/Listeners', 'VIRTUAL_ENV': '/Users/mkaur/Sites/todoman/.tox/py36', 'SHELL': '/bin/bash', 'LC_ALL': 'en_US.UTF-8', 'TMPDIR': '/var/folders/3j/xz5kwgvx297_45dgm2bgpr0h0000gn/T/', 'OLDPWD': '/Users/mkaur', '__CF_USER_TEXT_ENCODING': '0x1F5:0:0', 'PWD': '/Users/mkaur/sites/todoman'}

appdirs==1.4.0
atomicwrites==1.1.5
click==6.7
click-log==0.1.8
configobj==5.0.6
coverage==4.3.4
flake8==3.3.0
flake8-import-order==0.12
freezegun==0.3.8
future==0.16.0
hypothesis==3.6.1
icalendar==3.11.3
mccabe==0.6.1
packaging==16.8
parsedatetime==2.2
py==1.4.32
pycodestyle==2.3.1
pyflakes==1.5.0
pyparsing==2.1.10
pytest==3.0.6
pytest-cov==2.4.0
python-dateutil==2.6.0
pytz==2016.10
pyxdg==0.25
six==1.10.0
todoman==2.1.0.post13+ng96016ff.d20170223
urwid==1.3.1

@untitaker
Copy link
Member

ok that's a job for @hobarrera, I've no idea about pytest-runner.

To be clear, the tests and flake8 still fail?

@mansimarkaur
Copy link
Contributor Author

Yes, the flake8 tests fail because of a syntax error on https://github.com/pimutils/todoman/blob/master/todoman/model.py#L476
The py36 tests are giving an InvocationError because apparently easy_install is unable to find a suitable distribution for pytest-runner.

@untitaker
Copy link
Member

I pushed something to master that should fix the flake8 part at least. Could you try that (git pull)?

@mansimarkaur
Copy link
Contributor Author

It fixed the flake8 part and tests are passing for it.
Thanks :)

@untitaker
Copy link
Member

Great, then I suppose we can close this? :)

@mansimarkaur
Copy link
Contributor Author

Yes, I think this can be closed. Thanks for your help.
@hobarrera Could you please help me with the pytest-runner issue on my system?

@untitaker
Copy link
Member

I'm confused, so tox -epy36 still fails, only flake8 works now?

@mansimarkaur
Copy link
Contributor Author

Yes, tox -epy36 still fails because pytest-runner is not being installed by easy-install.
I think this could be a problem on my system only but I'm not sure.

@untitaker
Copy link
Member

Oh boy, oh boy:

Download error on https://pypi.python.org/simple/pytest-runner/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749) -- Some packages may not be found!

Hmm. Are you able to open https://pypi.python.org/ in your browser?

@mansimarkaur
Copy link
Contributor Author

Yes, I'm able to open https://pypi.python.org/ in my browser.

@untitaker
Copy link
Member

untitaker commented Feb 22, 2017

How did you install Python 3? I recommend Homebrew for installing it and keeping it up-to-date (you seem to be using OS X).

@mansimarkaur
Copy link
Contributor Author

mansimarkaur commented Feb 22, 2017

I downloaded the python-3.6.0 package from the python website.
I then setup a virtualenv because I use python2 for other projects following the section for Python 3 in this link: http://joebergantine.com/blog/2015/apr/30/installing-python-2-and-python-3-alongside-each-ot/
I use OSX. Doing a brew install python3 gives a Warning: python3-3.6.0 already installed now.

@untitaker
Copy link
Member

If you pip install requests under Python 3 and run python -c "__import__('requests').get('https://pypi.python.org')", does this cause any errors?

@mansimarkaur
Copy link
Contributor Author

mansimarkaur commented Feb 22, 2017

I pip installed requests and ran the command that you asked me to, it does not cause any errors.
I tried the same thing with pytest-runner just now (python -c "__import__('pytest-runner').get('https://pypi.python.org')") but it gave ModuleNotFoundError: No module named 'pytest-runner'

@untitaker
Copy link
Member

Interesting, I suppose pip install -U pip could solve all of this.

@mansimarkaur
Copy link
Contributor Author

mansimarkaur commented Feb 22, 2017

Running pip install -U pip gives Requirement already up-to-date: pip in ./todoman/lib/python3.6/site-packages
Running the tests after this, shows no changes in the errors that come up :(

@untitaker
Copy link
Member

Ok, that's weird.

In any case I'd recommend trying installation of Python 3 through homebrew.

@mansimarkaur
Copy link
Contributor Author

I tried installing python3 through homebrew but it didn't help with the pytest-runner issue.

@untitaker
Copy link
Member

I wonder you have Antivirus installed?

Otherwise I am running out of ideas :(

@mansimarkaur
Copy link
Contributor Author

No, I don't have AntiVirus installed.
I'm curious how this could possibly affect the pytest-runner issue.

@untitaker
Copy link
Member

untitaker commented Feb 23, 2017

The problem appears to be that pip can't establish a HTTPS connection to PyPI, so I thought perhaps some other software (Antivirus) was clumsily trying to intercept the connection for scanning.

@WhyNotHugo
Copy link
Member

Sorry, just to clarify, after installing python3 through homebrew, does this work:

pip3 install pytest-runner

(I'm guessing it'll be called pip3, not 100% familiar with homebrew/OSX).

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

No branches or pull requests

3 participants