When I execute my script without sudo:
$ python main.py
Traceback (most recent call last):
File "main.py", line 3, in <module>
import irc
File "/Users/judgej4/twitchchat/irc.py", line 3, in <module>
import asyncio
File "/Users/judgej4/anaconda3/lib/python3.6/site-packages/asyncio/__init__.py", line 21, in <module>
from .base_events import *
File "/Users/judgej4/anaconda3/lib/python3.6/site-packages/asyncio/base_events.py", line 18, in <module>
import concurrent.futures
File "/Users/judgej4/anaconda3/lib/python3.6/site-packages/concurrent/futures/__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "/Users/judgej4/anaconda3/lib/python3.6/site-packages/concurrent/futures/_base.py", line 381
raise exception_type, self._exception, self._traceback
^
SyntaxError: invalid syntax
When I execute with sudo, the syntax error goes away and script executes properly.
How would I go about debugging this?
EDIT Note that I'm using the same python version for each:
$ which python
/Users/judgej4/anaconda3/bin/python
$ sudo which python
/Users/judgej4/anaconda3/bin/python
I did notice that PYTHONPATH contains a few directories for the regular user which sudo does not:
/Users/judgej4/anaconda3/lib/python3.6/site-packages
/usr/local/Cellar/apache-spark/2.2.1/libexec/python
and it looks like the error is coming from the first directory.
I could remove that directory from my PYTHONPATH, but I'd rather fix the problem, which seems to be with anaconda
EDIT 2
$ python --version
Python 3.6.3 :: Anaconda custom (64-bit)
$ sudo python --version
Python 3.6.3 :: Anaconda custom (64-bit)
EDIT 3
$ command -v python
/Users/judgej4/anaconda3/bin/python
$ sudo command -v python
/Users/judgej4/anaconda3/bin/python