
from __future__ import absolute_import
import sys

from .disco import run_script
from . import shuffle

import tempfile

def main():
  script = sys.argv[1]
  if len(sys.argv) == 3:
    data_root = sys.argv[2]
  else:
    data_root = tempfile.mkdtemp()
  run_script(script, data_root)


if __name__ == "__main__":
  main()


from __future__ import absolute_import
import sys
import os

from .disco import run_script
from . import shuffle

import tempfile

def main():
  script = sys.argv[1]
  script_dir = os.path.abspath(os.path.dirname(script))
  if script_dir not in [os.path.abspath(p) for p in sys.path]:
    sys.path.append(script_dir)

  if len(sys.argv) == 3:
    data_root = sys.argv[2]
  else:
    data_root = tempfile.mkdtemp()
  run_script(script, data_root)


if __name__ == "__main__":
  main()

Add script's path to the python path
Add script's path to the python path
  
  from __future__ import absolute_import
  import sys
+ import os
  
  from .disco import run_script
  from . import shuffle
  
  import tempfile
  
  def main():
    script = sys.argv[1]
+   script_dir = os.path.abspath(os.path.dirname(script))
+   if script_dir not in [os.path.abspath(p) for p in sys.path]:
+     sys.path.append(script_dir)
+ 
    if len(sys.argv) == 3:
      data_root = sys.argv[2]
    else:
      data_root = tempfile.mkdtemp()
    run_script(script, data_root)
  
  
  if __name__ == "__main__":
    main()
  
Add script's path to the python path
## Code Before:

from __future__ import absolute_import
import sys

from .disco import run_script
from . import shuffle

import tempfile

def main():
  script = sys.argv[1]
  if len(sys.argv) == 3:
    data_root = sys.argv[2]
  else:
    data_root = tempfile.mkdtemp()
  run_script(script, data_root)


if __name__ == "__main__":
  main()

## Instruction:
Add script's path to the python path
## Code After:

from __future__ import absolute_import
import sys
import os

from .disco import run_script
from . import shuffle

import tempfile

def main():
  script = sys.argv[1]
  script_dir = os.path.abspath(os.path.dirname(script))
  if script_dir not in [os.path.abspath(p) for p in sys.path]:
    sys.path.append(script_dir)

  if len(sys.argv) == 3:
    data_root = sys.argv[2]
  else:
    data_root = tempfile.mkdtemp()
  run_script(script, data_root)


if __name__ == "__main__":
  main()
