I hate updating my OS. I only do so when I am left with no choice, like when so many packages conflicts appear as they are doing now. This time around the conflicts are related Oracle and SQL Server clients on Mint 17.3 (Ubuntu 14.04). In the old days upgrading mint was particularly diffcult because it doesn't have the 'dist upgrade' option found in other ubuntu deravatives. But luckily mintupgrade has appeared on the scene in recent times. It's rather slow but at least the computer is usable while the upgrade process is running. Whatever method you use for the upgrade, there are always one or two post upgrade issues. This is what Mint Sara (18) (Ubuntu 16.04)) came up with.
missing datetime in python.
Trying to start the django dev server with ./manage.py shell and this is the result:
Traceback (most recent call last): File "./manage.py", line 8, in <module> from django.core.management import execute_from_command_line File "/usr/local/virtual-django-19/local/lib/python2.7/site-packages/django/__init__.py", line 1, in <module> from django.utils.version import get_version File "/usr/local/virtual-django-19/local/lib/python2.7/site-packages/django/utils/version.py", line 3, in <module> import datetime ImportError: No module named datetime
The solution apparently is to replace the python binary in the virtualenv. I still haven't figured out why exactly that is so, but it certainly worked.
gvim and python
Error detected while processing /home/raditha/.vimrc: line 3: E319: Sorry, the command is not available in this version: py << EOF
What solved it was a comment on an askubuntu answer
Python3 is default interpreter for Ubuntu 16.04. If this message appears as a result of using
pycommand, replace it by Python 3 equivalent
gvim, python and execfile
That still leaves me with the following problem:
line 12: Traceback (most recent call last): File "<string>", line 8, in <module> NameError: name 'execfile' is not defined
The fix is described here: http://stackoverflow.com/a/6357418/267540
After both these changes, the first part of my .vimrc looks like this
py3 << EOF import os.path import sys import vim if 'VIRTUAL_ENV' in os.environ: project_base_dir = os.environ['VIRTUAL_ENV'] sys.path.insert(0, project_base_dir) activate_this = os.path.join(project_base_dir, 'bin/activate_this.py') exec(compile(open(activate_this,"rb").read(), activate_this, 'exec'), dict(__file__=activate_this)) EOF
Interestingly both the above vim/gvim related errors appear only when gvim is started after the virtualenv has been activated.