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")
import urllib import shutil from tempfile import mktemp, NamedTemporaryFile from ConfigParser import ConfigParser from httplib import HTTPConnection, HTTPSConnection from urlparse import urlparse
if not os.path.exists(content_file):
break
else:
content_file = mktemp(content_file)
logger.debug('Destination filename will be: %r.', content_file)
if not base:
base = getattr(self, 'input_file', 'noname')
base = os.path.basename(base)
fname = mktemp(suffix='-zopeedit-log.txt',
prefix='%s-' % base)
bkp_f = open(fname, 'wb')
def fatalError(message, exit=1):
"""Show error message and exit"""
global log_file
errorDialog('FATAL ERROR: %s' % message)
# Write out debug info to a temp file
debug_f = open(mktemp('-zopeedit-traceback.txt'), 'w')
try:
src/p/r/Products.ExternalEditor-1.0/Products/ExternalEditor/zopeedit.py Products.ExternalEditor(Download)
import urllib import shutil from tempfile import mktemp, NamedTemporaryFile from ConfigParser import ConfigParser from httplib import HTTPConnection, HTTPSConnection from urlparse import urlparse
if not os.path.exists(content_file):
break
else:
content_file = mktemp(content_file)
logger.debug('Destination filename will be: %r.', content_file)
if not base:
base = getattr(self, 'input_file', 'noname')
base = os.path.basename(base)
fname = mktemp(suffix='-zopeedit-log.txt',
prefix='%s-' % base)
bkp_f = open(fname, 'wb')
def fatalError(message, exit=1):
"""Show error message and exit"""
global log_file
errorDialog('FATAL ERROR: %s' % message)
# Write out debug info to a temp file
debug_f = open(mktemp('-zopeedit-traceback.txt'), 'w')
try:
src/c/p/cpacman-HEAD/cpacman/bundles/trunk-bundle/cpacman/cpacman/pycli/utils.py cpacman(Download)
from tempfile import mkstemp as mktemp
tempver=23
except ImportError:
from tempfile import mktemp
tempver=22
def mktmp(d,s):
""" Params:
s - suffix (like .sh)
d - directory (like /tmp)
returns tuple of (filehandle,path)
"""
res=mktemp(s,'cpacman',d)
src/c/p/cpacman-HEAD/cpacman/bundles/stabilizing-0.7/cpacman/cpacman/pycli/utils.py cpacman(Download)
from tempfile import mkstemp as mktemp
tempver=23
except ImportError:
from tempfile import mktemp
tempver=22
def mktmp(d,s):
""" Params:
s - suffix (like .sh)
d - directory (like /tmp)
returns tuple of (filehandle,path)
"""
res=mktemp(s,'cpacman',d)
src/c/p/cpacman-HEAD/cpacman/bundles/release-0.6/cpacman/cpacman/pycli/utils.py cpacman(Download)
from tempfile import mkstemp as mktemp
tempver=23
except ImportError:
from tempfile import mktemp
tempver=22
def mktmp(d,s):
""" Params:
s - suffix (like .sh)
d - directory (like /tmp)
returns tuple of (filehandle,path)
"""
res=mktemp(s,'cpacman',d)
src/p/y/pycli-HEAD/dvd_backup/bundles/trunk_bundle/dvd_backup/pycli/utils.py pycli(Download)
from tempfile import mkstemp as mktemp
tempver=23
except ImportError:
from tempfile import mktemp
tempver=22
def mktmp(d,s):
""" Params:
s - suffix (like .sh)
d - directory (like /tmp)
returns tuple of (filehandle,path)
"""
res=mktemp(s,'cpacman',d)
src/p/y/pycli-HEAD/pycli/trunk/lib/utils.py pycli(Download)
from tempfile import mkstemp as mktemp
tempver=23
except ImportError:
from tempfile import mktemp
tempver=22
def mktmp(d,s):
""" Params:
s - suffix (like .sh)
d - directory (like /tmp)
returns tuple of (filehandle,path)
"""
res=mktemp(s,'cpacman',d)
src/b/e/benri-0.0.3/benri/spool.py benri(Download)
# -*- coding: iso-8859-15 -*- # (c) Mikael Högqvist import os from benri.service import InitFailure from tempfile import mktemp
data until an EOF is found or StopIteration is raised.
"""
tmp_file = mktemp(prefix=self.__spool_path)
f = file(tmp_file, 'w+')
# 16k
src/u/m/umit-HEAD/umitCore/SearchResult.py umit(Download)
from glob import glob from fnmatch import fnmatch from tempfile import mktemp from types import StringTypes from umitCore.UmitDB import UmitDB
log.debug(">>> Retrieving result of scans_id %s" % scan.scans_id)
log.debug(">>> Nmap xml output: %s" % scan.nmap_xml_output)
temp_file = mktemp(".usr", "umit_")
tmp = open(temp_file, "w")
tmp.write(scan.nmap_xml_output)
src/k/m/kmkey-HEAD/bundles/kmkey-08.03.01/ExternalEditor/Plugins/winword.py kmkey(Download)
def test():
import os
from time import sleep
from tempfile import mktemp
fn = mktemp('.html')
f = open(fn, 'w')
f.write('<html>\n <head></head>\n'
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next