I have been trying to learn python-unipath and have been getting to grips with basic commands. However, I have been stumped by this issue. So, I would like to get the ancestor(2) of the current file. So, on the python interpretter, I do something like this:
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from unipath import Path
>>> ORM_ROOT = Path("/home/foo/lump/foobar/turf/orm/unipath_try.py").ancestor(2)
>>> ORM_ROOT
Path('/home/foo/lump/foobar/turf')
..which is correct and exactly what I want. Now, I wrap this in a file like so:
# -*- coding: utf-8 -*-
# unipath_try.py
from unipath import Path
ORM_ROOT = Path(__file__).ancestor(2)
print ORM_ROOT
when I run this using python unipath_try.py
I get no output! No import errors either.
I am completely baffled why this is - probably something really stupid.
Would appreciate any help/direction on this :(