(self, file_name_or_object, name=None, create=False)
return NameWrapper(self._impl.codepage, file_name_or_object)
Bind a native file name or Python stream to a BASIC file name.
Bind a native file name or Python stream to a BASIC file name.
Bind a native file name or Python stream to a BASIC file name .
def bind_file(self, file_name_or_object, name=None, create=False):
        """Bind a native file name or Python stream to a BASIC file name."""
        self.start()
        # if a file name, resolve
        if (
                not isinstance(file_name_or_object, (bytes, text_type))
                or os.path.isfile(file_name_or_object)
            ):
            # if it's an object or the file name exists, use it
            return self._impl.files.get_device(b'@:').bind(file_name_or_object, name)
        elif create and (
                not os.path.dirname(file_name_or_object) or
                os.path.isdir(os.path.dirname(file_name_or_object))
            ):
            # if it doesn't and we're allowed to create and the directory exists, create new
            return self._impl.files.get_device(b'@:').bind(file_name_or_object, name)
        # not resolved, try to use/create as internal name
        return NameWrapper(self._impl.codepage, file_name_or_object)
def bind_file ( self , file_name_or_object , name = None , create = False ) : self . start ( ) # if a file name, resolve if ( not isinstance ( file_name_or_object , ( bytes , text_type ) ) or os . path . isfile ( file_name_or_object ) ) : # if it's an object or the file name exists, use it return self . _impl . files . get_device ( b'@:' ) . bind ( file_name_or_object , name ) elif create and ( not os . path . dirname ( file_name_or_object ) or os . path . isdir ( os . path . dirname ( file_name_or_object ) ) ) : # if it doesn't and we're allowed to create and the directory exists, create new return self . _impl . files . get_device ( b'@:' ) . bind ( file_name_or_object , name ) # not resolved, try to use/create as internal name return NameWrapper ( self . _impl . codepage , file_name_or_object )