home *** CD-ROM | disk | FTP | other *** search
- <TITLE>riscos -- Python library reference</TITLE>
- Next: <A HREF="../r/riscospath" TYPE="Next">riscospath</A>
- Prev: <A HREF="../r/riscos_only" TYPE="Prev">RISCOS ONLY</A>
- Up: <A HREF="../r/riscos_only" TYPE="Up">RISCOS ONLY</A>
- Top: <A HREF="../t/top" TYPE="Top">Top</A>
- <H1>13.1. Built-in Module <CODE>riscos</CODE></H1>
- This module provides RiscOS ports of some POSIX funtions, and some RiscOS
- specific functions.
- <P>
- Errors are reported as exceptions; the usual exceptions are given
- for type errors, while errors reported by the system calls raise
- <CODE>riscos.error</CODE>, described below.
- <P>
- <DL><DT><B>error</B> -- exception of module riscos<DD>
- This exception is raised when an RiscOS function returns a
- RiscOS-related error (e.g., not for illegal argument types). Its
- string value is <CODE>'riscos.error'</CODE>. The accompanying value is a
- string describing the error, often that returned by the relevant SWI.
- </DL>
- It defines the following functions:
- <P>
- <DL><DT><B>chdir</B> (<VAR>path</VAR>) -- function of module riscos<DD>
- Change the current working directory to <VAR>path</VAR>.
- </DL>
- <DL><DT><B>chmod</B> (<VAR>path</VAR>, <VAR>mode</VAR>) -- function of module riscos<DD>
- Change the mode of <VAR>path</VAR> to the numeric <VAR>mode</VAR>.
- </DL>
- <DL><DT><B>expand</B> (<VAR>path</VAR>) -- function of module riscos<DD>
- Returns the canonical expansion of a pathname.
- </DL>
- <DL><DT><B>getcwd</B> () -- function of module riscos<DD>
- Return a string representing the current directory.
- </DL>
- <DL><DT><B>getenv</B> (<VAR>string</VAR>) -- function of module riscos<DD>
- Returns the string value of the environment variable <VAR>string</VAR>
- or <CODE>None</CODE> if it does not exist.
- </DL>
- <DL><DT><B>listdir</B> (<VAR>path</VAR>) -- function of module riscos<DD>
- Return a list containing the names of the entries in the directory.
- The list is in arbitrary order.
- </DL>
- <DL><DT><B>mkdir</B> (<VAR>path</VAR> [, <VAR>mode</VAR>]) -- function of module riscos<DD>
- Create a directory named <VAR>path</VAR>, at present <VAR>mode</VAR> is ignored.
- </DL>
- <DL><DT><B>putenv</B> (<VAR>name</VAR>, <VAR>string</VAR> [, <VAR>type</VAR>]) -- function of module riscos<DD>
- Sets the environment variable <VAR>name</VAR> to <VAR>string</VAR>.
- <DL>
- <DT><I>type</I><DD> --- <I>Meaning</I>
- <P>
- <DT>`<SAMP>0</SAMP>'<DD>GSTrans the string
- <DT>`<SAMP>1</SAMP>'<DD>Evaluate the string
- <DT>`<SAMP>3</SAMP>'<DD>Macro variable
- <DT>`<SAMP>4</SAMP>'<DD>No translation
- </DL>
- <VAR>type</VAR> defaults to 4 (no translation of the value string).
- </DL>
- <DL><DT><B>remove</B> (<VAR>path</VAR>) -- function of module riscos<DD>
- Remove the directory or file <VAR>path</VAR>.
- </DL>
- <DL><DT><B>rename</B> (<VAR>src</VAR>, <VAR>dst</VAR>) -- function of module riscos<DD>
- Rename the file or directory <VAR>src</VAR> to <VAR>dst</VAR>.
- </DL>
- <DL><DT><B>rmdir</B> (<VAR>path</VAR>) -- function of module riscos<DD>
- Remove the directory or file <VAR>path</VAR> (Same as remove).
- </DL>
- <DL><DT><B>settype</B> (<VAR>filename</VAR>, <VAR>type</VAR>) -- function of module riscos<DD>
- Sets the type of <VAR>filename</VAR>. <VAR>type</VAR> can be an integer or a string.
- </DL>
- <DL><DT><B>stat</B> (<VAR>path</VAR>) -- function of module riscos<DD>
- Perform a <I>stat</I> system call on the given path. The return value
- is a tuple of at least 10 integers giving the most important (and
- portable) members of the <I>stat</I> structure, in the order
- <CODE>st_mode</CODE>,
- <CODE>st_ino</CODE>,
- <CODE>st_dev</CODE>,
- <CODE>st_nlink</CODE>,
- <CODE>st_uid</CODE>,
- <CODE>st_gid</CODE>,
- <CODE>st_size</CODE>,
- <CODE>st_atime</CODE>,
- <CODE>st_mtime</CODE>,
- <CODE>st_ctime</CODE>.
- The RiscOS version adds three extra values, the file type, attributes and
- object type, as returned by osfile_read_stamped_no_path.
- The values <CODE>st_ino</CODE>,
- <CODE>st_dev</CODE>,
- <CODE>st_nlink</CODE>,
- <CODE>st_uid</CODE> and
- <CODE>st_gid</CODE> are all zero. The three times are all equal.
- <P>
- Note: The standard module <CODE>stat</CODE> defines functions and constants
- that are useful for extracting information from a stat structure.
- </DL>
- <DL><DT><B>system</B> (<VAR>command</VAR>) -- function of module riscos<DD>
- Execute the command (a string). This is implemented by
- calling the Standard C function <CODE>system()</CODE>, and has the same
- limitations.
- The return value is the exit status of the process as returned by Standard C
- <CODE>system()</CODE>.
- </DL>
- <DL><DT><B>unlink</B> (<VAR>path</VAR>) -- function of module riscos<DD>
- Unlink <VAR>path</VAR> (Same as remove).
- </DL>
- <DL><DT><B>utime</B> (<VAR>path</VAR>, (<VAR>atime</VAR>, <VAR>mtime</VAR>)) -- function of module riscos<DD>
- Set the time stamp of the file.
- (The second argument is a tuple of two items.) At present the second argument
- is ignored and the time is set to the current time.
- </DL>
-