Python Msvcrt For Mac

Python Msvcrt For Mac Average ratng: 9,8/10 7510 reviews

These functions provide access to some useful capabilities on Windows platforms.Some higher-level modules use these functions to build the Windowsimplementations of their services. For example, the getpass module usesthis in the implementation of the getpass() function.

Further documentation on these functions can be found in the Platform APIdocumentation.

FrameWork, MiniAEFrame Structured development of MacOS applications. Mkcwproject Create CodeWarrior projects (Macintosh). Msvcrt Miscellaneous. The Python code for a module named aname normally resides in a file named aname.py. Here's an example of a simple module, support.py. Def printfunc( par ): print 'Hello: ', par return The import Statement. You can use any Python source file as a module by executing an import statement in some other Python source file.

The module implements both the normal and wide char variants of the console I/Oapi. The normal API deals only with ASCII characters and is of limited usefor internationalized applications. The wide char API should be used whereever possible.

35.2.1. File Operations¶

msvcrt.locking(fd, mode, nbytes)

Lock part of a file based on file descriptor fd from the C runtime. RaisesIOError on failure. The locked region of the file extends from thecurrent file position for nbytes bytes, and may continue beyond the end of thefile. mode must be one of the LK_* constants listed below. Multipleregions in a file may be locked at the same time, but may not overlap. Adjacentregions are not merged; they must be unlocked individually.

msvcrt.LK_LOCK
msvcrt.LK_RLCK

Locks the specified bytes. If the bytes cannot be locked, the programimmediately tries again after 1 second. If, after 10 attempts, the bytes cannotbe locked, IOError is raised.

msvcrt.LK_NBLCK
msvcrt.LK_NBRLCK

Locks the specified bytes. If the bytes cannot be locked, IOError israised.

msvcrt.LK_UNLCK

Unlocks the specified bytes, which must have been previously locked.

msvcrt.setmode(fd, flags)

Set the line-end translation mode for the file descriptor fd. To set it totext mode, flags should be os.O_TEXT; for binary, it should beos.O_BINARY.

msvcrt.open_osfhandle(handle, flags)

Create a C runtime file descriptor from the file handle handle. The flagsparameter should be a bitwise OR of os.O_APPEND, os.O_RDONLY,and os.O_TEXT. The returned file descriptor may be used as a parameterto os.fdopen() to create a file object.

msvcrt.get_osfhandle(fd)

Return the file handle for the file descriptor fd. Raises IOError iffd is not recognized. Adobe audition 1.5 free download for mac.

35.2.2. Console I/O¶

msvcrt.kbhit()

Return true if a keypress is waiting to be read.

msvcrt.getch()

Read a keypress and return the resulting character. Nothing is echoed to theconsole. This call will block if a keypress is not already available, but willnot wait for Enter to be pressed. If the pressed key was a specialfunction key, this will return '000' or 'xe0'; the next call willreturn the keycode. The Control-C keypress cannot be read with thisfunction.

msvcrt.getwch()

Wide char variant of getch(), returning a Unicode value.

msvcrt.getche()

Similar to getch(), but the keypress will be echoed if it represents aprintable character.

msvcrt.getwche()

Wide char variant of getche(), returning a Unicode value.

New in version 2.6.

msvcrt.putch(char)

Print the character char to the console without buffering.

msvcrt.putwch(unicode_char)

Wide char variant of putch(), accepting a Unicode value.

msvcrt.ungetch(char)

Cause the character char to be “pushed back” into the console buffer; it willbe the next character read by getch() or getche().

msvcrt.ungetwch(unicode_char)

Wide char variant of ungetch(), accepting a Unicode value.

New in version 2.6.

35.2.3. Other Functions¶

msvcrt.heapmin()

Force the malloc() heap to clean itself up and return unused blocks tothe operating system. On failure, this raises IOError.

Author:A.M. Kuchling (amk at amk.ca)
Release:3.0.1
Date:February 14, 2009

This article explains the new features in Python 2.7.No release schedule has been decided yet for 2.7.

Other Language Changes¶

Some smaller changes made to the core Python language are:

  • List of changes to be written here.

New, Improved, and Deprecated Modules¶

As in every release, Python’s standard library received a number ofenhancements and bug fixes. Here’s a partial list of the most notablechanges, sorted alphabetically by module name. Consult theMisc/NEWS file in the source tree for a more complete list ofchanges, or look through the Subversion logs for all the details.

  • A new function in the subprocess module,check_output(), runs a command with a specified set of argumentsand returns the command’s output as a string if the command runs withouterror, or raises a CalledProcessError exception otherwise.

    Autocom cdp+ software download. (Contributed by Gregory P. Smith.)

ttk: Themed Widgets for Tk¶

Tcl/Tk 8.5 includes a set of themed widgets that re-implement basic Tkwidgets but have a more customizable appearance and can therefore moreclosely resemble the native platform’s widgets. This widgetset was originally called Tile, but was renamed to Ttk (for “themed Tk”)on being added to Tcl/Tck release 8.5.

XXX write a brief discussion and an example here.

The ttk module was written by Guilherme Polo and added inissue 2983. An alternate version called Tile.py, written byMartin Franklin and maintained by Kevin Walzer, was proposed forinclusion in issue 2618, but the authors argued that GuilhermePolo’s work was more comprehensive.

Build and C API Changes¶

Changes to Python’s build process and to the C API include:

  • If you use the .gdbinit file provided with Python,the “pyo” macro in the 2.7 version will now work when the thread beingdebugged doesn’t hold the GIL; the macro will now acquire it before printing.(Contributed by haypo XXX; issue 3632.)

Port-Specific Changes: Windows¶

  • The msvcrt module now contains some constants fromthe crtassem.h header file:CRT_ASSEMBLY_VERSION,VC_ASSEMBLY_PUBLICKEYTOKEN,and LIBRARIES_ASSEMBLY_NAME_PREFIX.(Added by Martin von Loewis (XXX check); issue 4365.)

Porting to Python 2.7¶

This section lists previously described changes and other bugfixesthat may require changes to your code:

To be written.

Acknowledgements¶

The author would like to thank the following people for offeringsuggestions, corrections and assistance with various drafts of thisarticle: no one yet.