• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

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)
        


src/i/p/ipython-py3k-HEAD/docs/examples/core/demo-exercizer.py   ipython-py3k(Download)
print 'bye!'
"""
fp = tempfile.mkdtemp(prefix = 'DemoTmp')
fd, filename = tempfile.mkstemp(prefix = 'demoExample1File', suffix = '.py',
                                dir = fp)
f = os.fdopen(fd, 'wt')
 

src/i/p/ipython-0.10/docs/examples/core/demo-exercizer.py   ipython(Download)
print 'bye!'
"""
fp = tempfile.mkdtemp(prefix = 'DemoTmp')
fd, filename = tempfile.mkstemp(prefix = 'demoExample1File', suffix = '.py',
                                dir = fp)
f = os.fdopen(fd, 'wt')
 

src/p/y/PyAMF-HEAD/doc/tutorials/examples/actionscript/bytearray/python/gateway/views.py   PyAMF(Download)
def save_snapshot(http_request, image, type):
    """
    Saves an image to the static image dir.
 
    @param image: A L{pyamf.amf3.ByteArray} instance
    """
    fp = tempfile.mkstemp(dir=gateway.images_root, prefix='snapshot_',

src/n/e/NeuroTools-0.1.0/examples/parameter_search/parameter_search_example.py   NeuroTools(Download)
    pylab.colorbar()
    # could add fancy xticks and yticks here
    import tempfile, os
    (fd,  figfilename) = tempfile.mkstemp(prefix = 'parameter_search_result', 
                                          suffix = '.png', 
                                          dir = os.getcwd())
    pylab.gcf().savefig(figfilename)

src/n/e/NeuroTools-0.1.0/examples/parameter_search/parameter_search.py   NeuroTools(Download)
        import subprocess, tempfile
        if furl_dir is None:
            furl_dir = tempfile.gettempdir()
        (fd, engine_furl) = tempfile.mkstemp(dir = furl_dir, 
                                             prefix = 'furl_engine_')
        (fd, multiengine_furl) = tempfile.mkstemp(dir = furl_dir,
                                                  prefix = 'furl_multiengine_')
        (fd, task_furl) = tempfile.mkstemp(dir = furl_dir,

src/p/i/pity-HEAD/examples/pity-pdf.py   pity(Download)
 
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/py2app-0.5.2/examples/EggInstaller/EggInstaller.py   py2app(Download)
def main():
    fd, name = tempfile.mkstemp(suffix='.py', prefix='EggInstaller')
    script = os.fdopen(fd, 'w+b')
    script.write(SCRIPT % (sys.executable, ['--'] + sys.argv[1:]))
    script.flush()
    script.close()
    os.chmod(name, 0700)

src/c/o/collective.harlequin-1.0b4/collective/harlequin/tests/test_example.py   collective.harlequin(Download)
    def contents(self):
        fd, fn = tmp.mkstemp(suffix=".html", prefix="testbrowser-")
        file = open(fn, 'w')
        file.write(self.browser.contents)
        file.close()
        print fn
 

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')

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next