Chris Angelico writes:
> So can you simply:
>
> $ python -m foo.fooprog
>
> ? (or 'python3', either way)
So, that's a pretty awful user interface. (The file is named ‘fooprog’
because it's an executable, intended to be run directly at the command
line.) That solution would be rather inferior to
Ben Finney :
> Solutions usually seem to entail contortions of cluttering the import
> block by discovering the current path, and fussing around with
> ‘sys.path’, before finally doing the import::
>
> #! /usr/bin/python3
>
> import sys
> import os.path
>
> program_dir = os.path.di
On Sat, Nov 22, 2014 at 11:37 AM, Ben Finney wrote:
> I don't think I'd ever want to specify an absolute file path for the
> module. But it would make my Python life immeasurably better if I could
> specify *relative* file paths for importing a module.
>
> Allowing relative paths makes this portab