Commit e200c0b6f7f12006d43ad63f49467644911780f1

Authored by Quillot Mathias
1 parent 65cfb375ff
Exists in master

Now we can import relatively to the executed module even if we use -m option of python command

Showing 2 changed files with 12 additions and 1 deletions Side-by-side Diff

  1 +""" Just a simple way to import relative modules when calling
  2 + modules with the option -m
  3 + exemple : python -m volia.script
  4 + if script import a module in the same namespace
  5 + this will not work because python will try to
  6 + find a module in the directory of execution, not those of the
  7 + module file.
  8 +"""
  9 +import sys
  10 +import os
  11 +sys.path.append(os.path.dirname(__file__))
1 1 import argparse
2 2 import sys
3 3  
4   -from volia.utils import SubCommandRunner
  4 +from utils import SubCommandRunner
5 5  
6 6 # Main parser
7 7 parser = argparse.ArgumentParser(description="manage files")