Use Script to open local file with local path
180109
function Openfile(i, path) {
            // !Optimized: use child_process module to open local file with local path
            (function() {
                var cmdArr = [
                    'nautilus ' + path
                  , 'start "" "' + path + '"'
                  , 'konqueror ' + path
                  , 'open ' + path
                ]
                ;
                
                if (i >= cmdArr.length) {
                    client.emit("complete", {
                        error: null
                      , output: path
                      , mannual: true
                    });
                }
                
                // recursive calling
                exec(cmdArr[i], function (err, stdout, stderr) {
                    if (err == null) {
                        // Success
                        client.emit("complete", {
                            error: null
                          , output: path
                          , mannual: false
                        });
                    } else {
                        Openfile(++i, path);
                    }
                });
            })();
        }
694757
def is_local(filename, pathlist):
  '''
  
  '''

  filename = os.path.abspath(filename)
  for path_name in pathlist:
    path_name = os.path.abspath(path_name)
    if is_subpath(filename, path_name):
      return True
  return False
872898
def open_file(self, url):
        """"""
        if not isinstance(url, str):
            raise URLError('file error: proxy support for file protocol currently not implemented')
        if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/':
            raise ValueError("file:// scheme is supported only on localhost")
        else:
            return self.open_local_file(url)
648689
def local_path(self, url, filename=None, decompress=False, download=False):
        
        if download:
            return self.fetch(url=url, filename=filename, decompress=decompress)
        else:
            filename = self.local_filename(url, filename, decompress)
            return join(self.cache_directory_path, filename)
6681
def get(self, path, local_path):
        
        normpath = os.path.normpath(local_path)
        folder = os.path.dirname(normpath)
        if folder and not os.path.exists(folder):
            os.makedirs(folder)

        tmp_local_path = local_path + '-luigi-tmp-%09d' % random.randrange(0, 1e10)

        # download file
        self._connect()

        if self.sftp:
            self._sftp_get(path, tmp_local_path)
        else:
            self._ftp_get(path, tmp_local_path)

        self._close()

        os.rename(tmp_local_path, local_path)
585023
function open (path, delimiter = '\r\n') {

  const self = this;
  const flags = 'r+';

  return new Promise((resolve, reject) => {
    // Open file for reading and writing. An exception occurs if the file does not exist.
    fs.open(path, flags, (error, fd) => {
      if (error) {
        reject(error);
        return;
      }

      try {
        let promise = self.term(path, delimiter, fd);
        resolve(promise);
      } catch (termError) {
        reject(termError);
      }
    });
  });
}
48889
def _open(self, file_path=None):
		
		if file_path is None:
			file_path = self.file_path

		if not os.path.exists(file_path):
			raise ValueError('Could not find file: {}'.format(file_path))

		try:
			f = open(file_path, encoding='utf-8', newline='')
		except OSError as err:
			self.log.error(str(err))
			raise ValueError('Could not open file: {}'.format(file_path))

		return f
423971
def open_in_browser(file_location):
    """"""

    # If just the name of the file was given, check if it's in the Current
    # Working Directory.
    if not os.path.isfile(file_location):
        file_location = os.path.join(os.getcwd(), file_location)
    if not os.path.isfile(file_location):
        raise IOError("\n\nFile not found.")

    #  For some reason OSX requires this adjustment (tested on 10.10.4)
    if sys.platform == "darwin":
        file_location = "file:///"+file_location

    new = 2  # open in a new tab, if possible
    webbrowser.get().open(file_location, new=new)
183428
def open(self, external_dir=None):
        
        if self.kind == 'data':
            with io.BytesIO(self._data.data) as f:
                yield f
        elif self.kind == 'external':
            filepath = self._data.linked_file[b'fullPath'].value
            filepath = filepath.replace('\x00', '').replace('file://', '')
            if not os.path.exists(filepath):
                filepath = self._data.linked_file[b'relPath'].value
                filepath = filepath.replace('\x00', '')
                if external_dir is not None:
                    filepath = os.path.join(external_dir, filepath)
            if not os.path.exists(filepath):
                raise FileNotFoundError(filepath)
            with open(filepath, 'rb') as f:
                yield f
        else:
            raise NotImplementedError('alias is not supported.')
678980
def write_str2file(pathname, astr):
    """"""
    fname = pathname
    fhandle = open(fname, 'wb')
    fhandle.write(astr)
    fhandle.close()
66335
def mkopen(p, *args, **kwargs):
    
    dir = os.path.dirname(p)
    mkdir(dir)
    return open(p, *args, **kwargs)
271332
def put(self, filename):
        
        from . import LocalFile
        target = get_target_path(filename, self.source)
        with self.open('rb') as infile, open(target, 'wb') as outfile:
            shutil.copyfileobj(infile, outfile)
        return LocalFile(target)
278063
def _local(self, args):
        '''
        
        '''
        args.pop(0)
        command = args[0]
        if command == 'install':
            self._local_install(args)
        elif command == 'files':
            self._local_list_files(args)
        elif command == 'info':
            self._local_info(args)
        else:
            raise SPMInvocationError('Invalid local command \'{0}\''.format(command))
161651
def run_file(path):
    """"""
    if PY26:
        dirpath, name, _ = splitname(path)
        found = imp.find_module(name, [dirpath])
        module = imp.load_module("__main__", *found)
        return vars(module)
    else:
        return runpy.run_path(path, run_name="__main__")
1192714
def try_opening_file(self):
        ''''''
        if os.path.isfile(self.path):
            self.file = open(self.path, 'r')
            self.file_is_opened = True
296857
def get_file(self, file_path, mode="r"):
        
        return open(self.p(file_path), mode=mode)
108609
def relpath(self, current_file, rel_path):
        
        script_dir = os.path.dirname(os.path.abspath(current_file))
        rel_path = os.path.abspath(os.path.join(script_dir, rel_path))
        return rel_path