All Samples(3570) | Call(3285) | Derive(0) | Import(285)
User-callable function to create and return a unique temporary file. The return value is a pair (fd, name) where fd is the file descriptor returned by os.open, and name is the filename. If 'suffix' is specified, the file name will end with that suffix, otherwise there will be no suffix. If 'prefix' is specified, the file name will begin with that prefix, otherwise a default prefix is used. If 'dir' is specified, the file will be created in that directory, otherwise a default directory is used. If 'text' is specified and true, the file is opened in text mode. Else (the default) the file is opened in binary mode. On some operating systems, this makes no difference. The file is readable and writable only by the creating user ID. If the operating system uses permission bits to indicate whether a file is executable, the file is executable by no one. The file descriptor is not inherited by children of this process. Caller is responsible for deleting the file when done with it.
def mkstemp(suffix="", prefix=template, dir=None, text=False):
"""User-callable function to create and return a unique temporary
file. The return value is a pair (fd, name) where fd is the
file descriptor returned by os.open, and name is the filename.
If 'suffix' is specified, the file name will end with that suffix,
otherwise there will be no suffix.
If 'prefix' is specified, the file name will begin with that prefix,
otherwise a default prefix is used.
If 'dir' is specified, the file will be created in that directory,
otherwise a default directory is used.
If 'text' is specified and true, the file is opened in text
mode. Else (the default) the file is opened in binary mode. On
some operating systems, this makes no difference.
The file is readable and writable only by the creating user ID.
If the operating system uses permission bits to indicate whether a
file is executable, the file is executable by no one. The file
descriptor is not inherited by children of this process.
Caller is responsible for deleting the file when done with it.
"""
if dir is None:
dir = gettempdir()
if text:
flags = _text_openflags
else:
flags = _bin_openflags
return _mkstemp_inner(dir, prefix, suffix, flags)
import sys import pity from tempfile import mkstemp from os import listdir, unlink, path, fdopen from lxml import etree import subprocess
temps = [] # array of temp files to delete at the end of program values = pity.read_data(sys.argv[1]) for p in pits: (f, temp_svg) = mkstemp(suffix = '.svg', prefix = 'pity') output = fdopen(f, "w") (f, temp_svg2) = mkstemp(suffix = '.svg', prefix = 'pity') fdopen(f).close() (f, temp_pdf) = mkstemp(suffix = '.pdf', prefix = 'pity')
src/p/y/pyfusion-HEAD/examples/test_savez.py pyfusion(Download)
# now see how fast it is for a little one small=arange(10) st=time() from tempfile import gettempdir, gettempprefix, mkstemp #tmp=gettempdir()+gettempprefix() tmpfd=mkstemp(suffix='.npz')
src/n/i/nipy-HEAD/examples/image_fromarray.py nipy(Download)
################################################################################ # Imports used just for development and testing. Users typically # would not uses these when creating an image. from tempfile import mkstemp from nipy.testing import assert_equal # We use a temporary file for this example so as to not create junk # files in the nipy directory. fd, name = mkstemp(suffix='.nii.gz')
src/n/i/NiPy-OLD-HEAD/examples/image_fromarray.py NiPy-OLD(Download)
################################################################################ # Imports used just for development and testing. Users typically # would not uses these when creating an image. from tempfile import mkstemp from nipy.testing import assert_equal # We use a temporary file for this example so as to not create junk # files in the nipy directory. fd, name = mkstemp(suffix='.nii.gz')
src/n/i/nitro-nitf-HEAD/trunk/python/nitf/samples/test_make_nitf.py nitro-nitf(Download)
""" import os, sys, array, unittest, random from nitf import * from tempfile import mkstemp from datetime import datetime import logging
imagesource.addBand(MemoryBandSource(alldata, len(alldata)/numBands, i, 1, numBands-1))
try:
handle, outfile = mkstemp(suffix='.ntf')
os.close(handle)
writer = Writer()
outhandle = IOHandle(outfile, IOHandle.ACCESS_WRITEONLY, IOHandle.CREATE)
src/a/u/audiolab-HEAD/docs/src/examples/obsolete/write1.py audiolab(Download)
from tempfile import mkstemp
from os import remove
import numpy as N
from scikits.audiolab import formatinfo as format
import scikits.audiolab as audiolab
# Create a temp file in the system temporary dir, and always remove
# it at the end
cd, filename = mkstemp('tmptest.wav')
src/a/u/audiolab-HEAD/docs/src/examples/matlab1.py audiolab(Download)
from tempfile import mkstemp
from os.path import join, dirname
from os import remove
from scikits.audiolab import wavread, wavwrite
(tmp, fs, enc) = wavread('test.wav')
print "The file has %d frames, %d channel(s)" % (tmp.shape[0], nc)
print "FS is %f, encoding is %s" % (fs, enc)
fd, cfilename = mkstemp('pysndfiletest.wav')
try:
wavwrite(tmp, cfilename, fs = 16000, enc = 'pcm24')
finally:
src/n/e/NeuroTools-0.1.0/examples/single_neuron/playing_with_simple_single_neuron.py NeuroTools(Download)
"""
from tempfile import mkstemp
fd, cfilename = mkstemp('SpikeListPlay.wav')
try:
record(output, cfilename)
src/s/c/scikits.audiolab-0.11.0/docs/src/examples/obsolete/write1.py scikits.audiolab(Download)
from tempfile import mkstemp
from os import remove
import numpy as N
from scikits.audiolab import formatinfo as format
import scikits.audiolab as audiolab
# Create a temp file in the system temporary dir, and always remove
# it at the end
cd, filename = mkstemp('tmptest.wav')
src/s/c/scikits.audiolab-0.11.0/docs/src/examples/matlab1.py scikits.audiolab(Download)
from tempfile import mkstemp
from os.path import join, dirname
from os import remove
from scikits.audiolab import wavread, wavwrite
(tmp, fs, enc) = wavread('test.wav')
print "The file has %d frames, %d channel(s)" % (tmp.shape[0], nc)
print "FS is %f, encoding is %s" % (fs, enc)
fd, cfilename = mkstemp('pysndfiletest.wav')
try:
wavwrite(tmp, cfilename, fs = 16000, enc = 'pcm24')
finally:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next