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

All Samples(3076)  |  Call(2861)  |  Derive(0)  |  Import(215)
User-callable function to return a unique temporary file name.  The
file is not created.

Arguments are as for mkstemp, except that the 'text' argument is
not accepted.

This function is unsafe and should not be used.  The file name
refers to a file that did not exist at some point, but by the time
you get around to creating it, someone else may have beaten you to
the punch.

        def mktemp(suffix="", prefix=template, dir=None):
    """User-callable function to return a unique temporary file name.  The
    file is not created.

    Arguments are as for mkstemp, except that the 'text' argument is
    not accepted.

    This function is unsafe and should not be used.  The file name
    refers to a file that did not exist at some point, but by the time
    you get around to creating it, someone else may have beaten you to
    the punch.
    """

##    from warnings import warn as _warn
##    _warn("mktemp is a potential security risk to your program",
##          RuntimeWarning, stacklevel=2)

    if dir is None:
        dir = gettempdir()

    names = _get_candidate_names()
    for seq in xrange(TMP_MAX):
        name = names.next()
        file = _os.path.join(dir, prefix + name + suffix)
        if not _exists(file):
            return file

    raise IOError, (_errno.EEXIST, "No usable temporary filename found")
        


src/b/i/biskit-HEAD/trunk/Biskit/PVM/ExampleSlave.py   biskit(Download)
 
    import tempfile, os, sys
 
    f_out = open( tempfile.mktemp( '.out', 'slave_', os.getcwd() ), 'w' )
 
    sys.stdout = f_out
    sys.stderr = f_out

src/b/i/biskit-HEAD/Biskit/PVM/ExampleSlave.py   biskit(Download)
 
    import tempfile, os, sys
 
    f_out = open( tempfile.mktemp( '.out', 'slave_', os.getcwd() ), 'w' )
 
    sys.stdout = f_out
    sys.stderr = f_out

src/m/a/matplotlib-HEAD/toolkits/basemap/examples/NetCDFFile_tst.py   matplotlib(Download)
# test automatic conversion of masked arrays, and
# packing/unpacking of short ints.
 
FILE_NAME = tempfile.mktemp(".nc")
ndim = 10
ranarr = 100.*uniform(size=(ndim))
packeddata = 10.*uniform(size=(ndim))

src/p/y/pyid3-HEAD/test/test_samples240.py   pyid3(Download)
        for tag_file in tag_list:
            print tag_file
            tag_file = os.path.join(mydir, tag_file)
            tfn = tempfile.mktemp('id3v2.tag')
            shutil.copyfile(tag_file, tfn)
 
            try:

src/p/y/pyid3-HEAD/test/test_samples230.py   pyid3(Download)
        tag_list.sort()
        for fn in tag_list:
            tag_file = os.path.join(mydir, fn)
            tfn = tempfile.mktemp('id3v2.tag')
            shutil.copyfile(tag_file, tfn)
 
            try:

src/p/y/pymol-HEAD/trunk/pymol/examples/devel/xmlrpc01.py   pymol(Download)
"""
import sys,xmlrpclib,tempfile,os
 
fName = tempfile.mktemp('.mol')
open(fName,'w+').write(molData)
port = 9123
if len(sys.argv)>1:

src/p/y/pymol-HEAD/pymol/examples/devel/xmlrpc01.py   pymol(Download)
"""
import sys,xmlrpclib,tempfile,os
 
fName = tempfile.mktemp('.mol')
open(fName,'w+').write(molData)
port = 9123
if len(sys.argv)>1:

src/p/y/pymilter-0.9.3/sample.py   pymilter(Download)
    # copy headers to a temp file for scanning the body
    headers = self.fp.getvalue()
    self.fp.close()
    self.tempname = fname = tempfile.mktemp(".defang")
    self.fp = open(fname,"w+b")
    self.fp.write(headers)	# IOError (e.g. disk full) causes TEMPFAIL
    return Milter.CONTINUE

src/d/j/django-navbar-0.3.0/examples/dbgp/_logging/config.py   django-navbar(Download)
                    #1.5.2 ConfigParser does not support reading file
                    #objects, only actual files. So we create a temporary
                    #file and remove it later.
                    file = tempfile.mktemp(".ini")
                    f = open(file, "w")
                    f.write(chunk)
                    f.close()

src/m/w/mwlib-0.12.13/mwlib/writer/licensechecker.py   mwlib(Download)
    def dumpUnknownLicenses(self, _dir):
        if not self.unknown_licenses:
            return
        fn = tempfile.mktemp(dir=_dir, prefix='licensestats_',  suffix='.json')
        f = open(fn, 'w')
        unknown_licenses = {}
        for (license, urls) in self.unknown_licenses.items():

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