file

The file commands module.

These commands are used in the following models: DAQ6510, DMM6500, DMM7510, SMU2450, SMU2460, SMU2461, SMU2470

THIS FILE IS AUTO-GENERATED, IT SHOULD NOT BE MANUALLY MODIFIED.

Please report an issue if one is found.

Attributes and Functions
- file.close()
- file.flush()
- file.mkdir()
- file.open()
- file.read()
- file.usbdriveexists()
- file.write()

File

Bases: BaseTSPCmd

The file command tree.

Constants
  • .MODE_APPEND: Append the file.
  • .MODE_READ: Read the file.
  • .MODE_WRITE: Write to the file.
  • .READ_ALL: Return the whole file, starting at the present position; returns nil if the present file position is at the end of the file.
  • .READ_LINE: Return the next line; returns nil if the present file position is at the end of the file.
  • .READ_NUMBER: Return a string that represents the number found; returns an event string if no number was found; returns nil if the current file position is at the end of file.
Properties and methods
  • .close(): The file.close() function.
  • .flush(): The file.flush() function.
  • .mkdir(): The file.mkdir() function.
  • .open(): The file.open() function.
  • .read(): The file.read() function.
  • .usbdriveexists(): The file.usbdriveexists() function.
  • .write(): The file.write() function.

MODE_APPEND class-attribute instance-attribute

MODE_APPEND = 'file.MODE_APPEND'

MODE_READ class-attribute instance-attribute

MODE_READ = 'file.MODE_READ'

MODE_WRITE class-attribute instance-attribute

MODE_WRITE = 'file.MODE_WRITE'

READ_ALL class-attribute instance-attribute

READ_ALL = 'file.READ_ALL'

READ_LINE class-attribute instance-attribute

READ_LINE = 'file.READ_LINE'

READ_NUMBER class-attribute instance-attribute

READ_NUMBER = 'file.READ_NUMBER'

close

close(file_number: int) -> None

Run the file.close() function.

Description
  • This function closes a file on the USB flash drive.
TSP Syntax
- file.close()
Parameters:
  • file_number (int) –

    The file number returned from the file.open() function to close.

Raises:

flush

flush(file_number: int) -> None

Run the file.flush() function.

Description
  • This function writes buffering data to a file on the USB flash drive.
TSP Syntax
- file.flush()
Parameters:
  • file_number (int) –

    The file number returned from the file.open() function to flush.

Raises:

mkdir

mkdir(path: str) -> None

Run the file.mkdir() function.

Description
  • This function creates a directory at the specified path on the USB flash drive.
TSP Syntax
- file.mkdir()
Parameters:
  • path (str) –

    A string that contains the path of the directory.

Raises:

open

open(file_name: str, access_type: str) -> str

Run the file.open() function.

Description
  • This function opens a file on the USB flash drive for later reference.
TSP Syntax
- file.open()
Parameters:
  • file_name (str) –

    A string that contains the file name to open, including the full path of file.

  • access_type (str) –

    The type of action to do.

Returns:
  • str

    The result of the function call.

Raises:

read

read(file_number: int, read_action: str) -> str

Run the file.read() function.

Description
  • This function reads data from a file on the USB flash drive.
TSP Syntax
- file.read()
Parameters:
  • file_number (int) –

    The file number returned from the file.open() function to read.

  • read_action (str) –

    The action.

Returns:
  • str

    The result of the function call.

Raises:

usbdriveexists

usbdriveexists() -> str

Run the file.usbdriveexists() function.

Description
  • This function detects if a USB flash drive is inserted into the front-panel USB port.
TSP Syntax
- file.usbdriveexists()
Returns:
  • str

    The result of the function call.

Raises:

write

write(file_number: int, string: str) -> None

Run the file.write() function.

Description
  • This function writes data to a file on the USB flash drive.
TSP Syntax
- file.write()
Parameters:
  • file_number (int) –

    The file number returned from the file.open() function to write.

  • string (str) –

    A string that contains the data to write to the file.

Raises: