本文整理汇总了Python中shutil.unpack_archive函数的典型用法代码示例。如果您正苦于以下问题:Python unpack_archive函数的具体用法?Python unpack_archive怎么用?Python unpack_archive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unpack_archive函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: extract_package
def extract_package(self, package):
if sys.version_info < (3, 5):
try:
import lzma
del lzma
try:
shutil.register_unpack_format('xztar', ['.tar.xz', '.txz'], shutil._unpack_tarfile, [], "xz'ed tar-file")
except shutil.RegistryError:
pass
except ImportError:
pass
target_dir = os.path.join(self.subdir_root, package.get('directory'))
if os.path.isdir(target_dir):
return
extract_dir = self.subdir_root
# Some upstreams ship packages that do not have a leading directory.
# Create one for them.
try:
package.get('lead_directory_missing')
os.mkdir(target_dir)
extract_dir = target_dir
except KeyError:
pass
shutil.unpack_archive(os.path.join(self.cachedir, package.get('source_filename')), extract_dir)
if package.has_patch():
shutil.unpack_archive(os.path.join(self.cachedir, package.get('patch_filename')), self.subdir_root)
开发者ID:osimola,项目名称:meson,代码行数:26,代码来源:wrap.py
示例2: read_gtfs
def read_gtfs(path):
"""
Given a path (string or pathlib object) to a (zipped) GTFS feed,
read the feed and return its corresponding Feed instance.
NOTES:
- Ignore files that are not valid GTFS; see https://developers.google.com/transit/gtfs/reference/.
- Ensure that all ID fields that could be string ('stop_id', 'route_id', etc.) are parsed as strings and not as numbers.
"""
path = Path(path)
# Unzip feed into temporary directory
tmp_dir = tempfile.TemporaryDirectory()
shutil.unpack_archive(str(path), tmp_dir.name, 'zip')
# Read valid GTFS files into Pandas data frames
feed_dict = {}
dtype = {field: str for field in Feed.str_fields} # ensure some string types
for p in Path(tmp_dir.name).iterdir():
name = p.stem
if name in Feed.gtfs_tables:
feed_dict[name] = pd.read_csv(p, dtype=dtype)
# Delete temporary directory
tmp_dir.cleanup()
return Feed(**feed_dict)
开发者ID:araichev,项目名称:pyclub,代码行数:27,代码来源:new_gtfs_tools.py
示例3: get_pos_latin_tar
def get_pos_latin_tar(self):
"""Fetch Latin part-of-speech files"""
orig_files_dir_pos_latin = os.path.join(self.orig_files_dir,
'pos_latin')
pg_url = 'https://raw.githubusercontent.com/cltk/pos_latin/' \
'master/pos_latin.tar.gz'
session = requests.Session()
session.mount(pg_url, SSLAdapter(ssl.PROTOCOL_TLSv1))
pg_tar = session.get(pg_url, stream=True)
pos_latin_file_name = urlsplit(pg_url).path.split('/')[-1]
pos_latin_file_path = os.path.join(orig_files_dir_pos_latin,
pos_latin_file_name)
try:
with open(pos_latin_file_path, 'wb') as new_file:
new_file.write(pg_tar.content)
logging.info('Finished writing %s.', pos_latin_file_name)
except IOError:
logging.error('Failed to write file %s', pos_latin_file_name)
compiled_files_dir_pos_latin = os.path.join(self.compiled_files_dir,
'pos_latin')
if os.path.isdir(compiled_files_dir_pos_latin) is True:
pass
else:
os.mkdir(compiled_files_dir_pos_latin)
logging.info('Made new directory "pos_latin" at "%s"',
compiled_files_dir_pos_latin)
try:
shutil.unpack_archive(pos_latin_file_path, compiled_files_dir_pos_latin)
logging.info('Finished unpacking %s', pos_latin_file_name)
except IOError:
logging.info('Failed to unpack %s.', pos_latin_file_name)
开发者ID:smargh,项目名称:cltk,代码行数:31,代码来源:compiler.py
示例4: get_sentence_tokens_greek_tar
def get_sentence_tokens_greek_tar(self):
"""Fetch algorithm for Greek sentence tokenization"""
orig_files_dir_tokens_greek = \
os.path.join(self.orig_files_dir, 'sentence_tokens_greek')
# make compiled files dir for tokens_greek
compiled_files_dir_tokens_greek = \
os.path.join(self.compiled_files_dir, 'sentence_tokens_greek')
if os.path.isdir(compiled_files_dir_tokens_greek) is True:
pass
else:
os.mkdir(compiled_files_dir_tokens_greek)
pg_url = 'https://raw.githubusercontent.com/cltk/' \
'cltk_greek_sentence_tokenizer/master/greek.tar.gz'
session = requests.Session()
session.mount(pg_url, SSLAdapter(ssl.PROTOCOL_TLSv1))
pg_tar = session.get(pg_url, stream=True)
tokens_greek_file_name = urlsplit(pg_url).path.split('/')[-1]
tokens_greek_file_path = os.path.join(orig_files_dir_tokens_greek,
tokens_greek_file_name)
try:
with open(tokens_greek_file_path, 'wb') as new_file:
new_file.write(pg_tar.content)
logging.info('Finished writing %s.', tokens_greek_file_name)
try:
shutil.unpack_archive(tokens_greek_file_path,
compiled_files_dir_tokens_greek)
logging.info('Finished unpacking %s.',
tokens_greek_file_name)
except IOError:
logging.info('Failed to unpack %s.',
tokens_greek_file_name)
except IOError:
logging.error('Failed to write file %s', tokens_greek_file_name)
开发者ID:smargh,项目名称:cltk,代码行数:33,代码来源:compiler.py
示例5: get_lacus_curtius_latin_tar
def get_lacus_curtius_latin_tar(self):
"""Fetch lacus_curtius_latin_tar"""
orig_files_dir_lacus_curtius_latin = \
os.path.join(self.orig_files_dir, 'lacus_curtius_latin')
lc_url = 'https://raw.githubusercontent.com/cltk/' \
'latin_corpus_lacus_curtius/master/lacus_curtius.tar.gz'
session = requests.Session()
session.mount(lc_url, SSLAdapter(ssl.PROTOCOL_TLSv1))
ll_tar = session.get(lc_url, stream=True)
lacus_curtius_latin_file_name = urlsplit(lc_url).path.split('/')[-1]
lacus_curtius_latin_file_path = \
os.path.join(orig_files_dir_lacus_curtius_latin,
lacus_curtius_latin_file_name)
try:
with open(lacus_curtius_latin_file_path, 'wb') as new_file:
new_file.write(ll_tar.content)
logging.info('Finished writing %s.',
lacus_curtius_latin_file_name)
except IOError:
logging.error('Failed to write file %s',
lacus_curtius_latin_file_name)
try:
shutil.unpack_archive(lacus_curtius_latin_file_path,
self.compiled_files_dir)
logging.info('Finished unpacking %s',
lacus_curtius_latin_file_name)
except IOError:
logging.info('Failed to unpack %s.', lacus_curtius_latin_file_name)
开发者ID:smargh,项目名称:cltk,代码行数:28,代码来源:compiler.py
示例6: get_treebank_perseus_latin_tar
def get_treebank_perseus_latin_tar(self):
"""Fetch Perseus's Latin treebank files"""
compiled_files_dir_treebank_perseus_latin = os.path.join(self.compiled_files_dir, 'treebank_perseus_latin')
if os.path.isdir(compiled_files_dir_treebank_perseus_latin) is True:
pass
else:
os.mkdir(compiled_files_dir_treebank_perseus_latin)
logging.info('Made new directory at "%s"', compiled_files_dir_treebank_perseus_latin)
orig_files_dir_treebank_perseus_latin = \
os.path.join(self.orig_files_dir, 'treebank_perseus_latin')
pg_url = 'https://raw.githubusercontent.com/cltk/latin_treebank_perseus/master/latin_treebank_perseus.tar.gz'
session = requests.Session()
session.mount(pg_url, SSLAdapter(ssl.PROTOCOL_TLSv1))
pg_tar = session.get(pg_url, stream=True)
treebank_perseus_latin_file_name = urlsplit(pg_url).path.split('/')[-1]
treebank_perseus_latin_file_path = \
os.path.join(orig_files_dir_treebank_perseus_latin,
treebank_perseus_latin_file_name)
try:
with open(treebank_perseus_latin_file_path, 'wb') as new_file:
new_file.write(pg_tar.content)
logging.info('Finished writing %s.',
treebank_perseus_latin_file_name)
except IOError:
logging.error('Failed to write file %s',
treebank_perseus_latin_file_name)
try:
shutil.unpack_archive(treebank_perseus_latin_file_path,
compiled_files_dir_treebank_perseus_latin)
logging.info('Finished unpacking %s',
treebank_perseus_latin_file_name)
except IOError:
logging.info('Failed to unpack %s.',
treebank_perseus_latin_file_name)
开发者ID:smargh,项目名称:cltk,代码行数:34,代码来源:compiler.py
示例7: unpack
def unpack(sproj, branch, outdir):
subprocess.check_call(['git', 'clone', '-b', branch, 'https://github.com/mesonbuild/%s.git' % sproj, outdir])
usfile = os.path.join(outdir, 'upstream.wrap')
assert(os.path.isfile(usfile))
config = configparser.ConfigParser()
config.read(usfile)
us_url = config['wrap-file']['source_url']
us = urllib.request.urlopen(us_url).read()
h = hashlib.sha256()
h.update(us)
dig = h.hexdigest()
should = config['wrap-file']['source_hash']
if dig != should:
print('Incorrect hash on download.')
print(' expected:', dig)
print(' obtained:', should)
return 1
spdir = os.path.split(outdir)[0]
ofilename = os.path.join(spdir, config['wrap-file']['source_filename'])
with open(ofilename, 'wb') as ofile:
ofile.write(us)
if 'lead_directory_missing' in config['wrap-file']:
os.mkdir(outdir)
shutil.unpack_archive(ofilename, outdir)
else:
shutil.unpack_archive(ofilename, spdir)
extdir = os.path.join(spdir, config['wrap-file']['directory'])
assert(os.path.isdir(extdir))
shutil.move(os.path.join(outdir, '.git'), extdir)
subprocess.check_call(['git', 'reset', '--hard'], cwd=extdir)
shutil.rmtree(outdir)
shutil.move(extdir, outdir)
shutil.rmtree(os.path.join(outdir, '.git'))
os.unlink(ofilename)
开发者ID:pombredanne,项目名称:meson,代码行数:34,代码来源:ghwt.py
示例8: get_treebank_perseus_latin_tar
def get_treebank_perseus_latin_tar(self):
"""Fetch Persus's Latin treebank files"""
orig_files_dir_treebank_perseus_latin = \
os.path.join(self.orig_files_dir, 'treebank_perseus_latin')
pg_url = 'https://raw.githubusercontent.com/kylepjohnson/' \
'treebank_perseus_latin/master/treebank_perseus_latin.tar.gz'
session = requests.Session()
session.mount(pg_url, SSLAdapter(ssl.PROTOCOL_TLSv1))
pg_tar = session.get(pg_url, stream=True)
treebank_perseus_latin_file_name = urlsplit(pg_url).path.split('/')[-1]
treebank_perseus_latin_file_path = \
os.path.join(orig_files_dir_treebank_perseus_latin,
treebank_perseus_latin_file_name)
try:
with open(treebank_perseus_latin_file_path, 'wb') as new_file:
new_file.write(pg_tar.content)
logging.info('Finished writing %s.',
treebank_perseus_latin_file_name)
except IOError:
logging.error('Failed to write file %s',
treebank_perseus_latin_file_name)
try:
shutil.unpack_archive(treebank_perseus_latin_file_path,
self.compiled_files_dir)
logging.info('Finished unpacking %s',
treebank_perseus_latin_file_name)
except IOError:
logging.info('Failed to unpack %s.',
treebank_perseus_latin_file_name)
开发者ID:AmitShilo,项目名称:cltk,代码行数:29,代码来源:compiler.py
示例9: download
def download(self):
furlo = FBURLopener({})
try:
tmpfile, msg = furlo.retrieve(self.url, reporthook=self.rhook)
print()
except HTTPError as ex:
urlcleanup()
sys.exit(ex)
except URLError as ex:
urlcleanup()
sys.exit(ex)
if os.path.exists(self.dlpath) and filecmp.cmp(self.dlpath, tmpfile):
print('You already have the newest version of ' + self.plugin)
done = True
else:
shutil.copyfile(tmpfile, self.dlpath)
print(self.plugin + ' downloaded.')
done = False
urlcleanup()
if done or self.format == 'jar':
return
try:
shutil.unpack_archive(self.dlpath, self.dest_dir, self.format)
except ValueError as ex:
sys.exit('Error: ' + str(ex))
开发者ID:kevlar1818,项目名称:fillbukkit,代码行数:25,代码来源:fb_dl.py
示例10: restore
def restore(self, backup_file, message=str(), delay=0):
"""
Restores the backup of the world from the given *backup_file*. If
the backup archive contains the configuration and the server, they
are restored too.
Raises: Exception
A lot of things can go wrong here, so catch *Exception* if you
want to be sure, you catch everything.
"""
# Extract the backup in a temporary directory and copy then all things
# into the EMSM directories.
with tempfile.TemporaryDirectory() as temp_dir:
shutil.unpack_archive(
filename = backup_file,
extract_dir = temp_dir
)
# Stop the world.
was_online = self.world.is_online()
if was_online:
self.world.send_command("say {}".format(message))
time.sleep(delay)
self.world.kill_processes()
# Restore the world.
manifest = self._get_manifest(temp_dir)
self._restore_world(manifest, temp_dir)
self._restore_world_configuration(manifest, temp_dir)
self._restore_server(manifest, temp_dir)
if was_online:
self.world.start()
return None
开发者ID:aaomidi,项目名称:emsm,代码行数:35,代码来源:backups.py
示例11: get_file_content
def get_file_content( params, target_directory ):
directory_content = params.get( 'directory_content', [] )
for content in directory_content:
target_path = os.path.join( target_directory, content.get( 'subdir', '' ) )
try:
os.makedirs( target_path )
except OSError:
pass
if content.get( 'file_source', {}).get( 'file_source_selector', None ) == 'URL':
( filename, headers ) = urlretrieve( content.get( 'file_source', {}).get( 'file_URL', None ) )
try:
bname = headers['Content-Disposition']
except KeyError:
bname = os.path.basename( urllib2.urlparse.urlsplit( content.get( 'file_source', {}).get( 'file_URL', None ) ).path )
else:
filename = content.get( 'file_source', {}).get( 'file_history', None )
bname = os.path.basename( filename )
file_action = content.get( 'file_action', {}).get( 'file_action_selector', None )
if file_action == 'unpack':
unpack_archive( filename, target_path )
else:
filename_override = content.get( 'file_action', {}).get( 'filename_override', None )
if filename_override:
target_path = os.path.join( target_path, filename_override )
else:
target_path = os.path.join( target_path, bname )
shutil.copyfile( filename, target_path )
return len( directory_content )
开发者ID:bimbam23,项目名称:tools-iuc,代码行数:28,代码来源:data_manager_manual.py
示例12: restore
def restore(self, backup_file, message=str(), delay=0):
"""
Restores the backup backup_file.
Raises: WorldError
"""
with tempfile.TemporaryDirectory() as temp_dir:
shutil.unpack_archive(
filename = backup_file,
extract_dir = temp_dir
)
# Stop the world.
was_online = self.world.is_online()
if was_online:
self.world.send_command("say {}".format(message))
time.sleep(delay)
self.world.kill_processes()
# Delete the world and restore the backup.
for i in range(5):
# XXX: Fixes an error with server.log.lck
# and shutil.rmtree(...).
try:
shutil.rmtree(self.world.directory)
break
except OSError:
time.sleep(0.05)
shutil.copytree(temp_dir, self.world.directory)
if was_online:
self.world.start()
return None
开发者ID:GhostGambler,项目名称:emsm,代码行数:33,代码来源:backups.py
示例13: get_cltk_latin_linguistic_data_tar
def get_cltk_latin_linguistic_data_tar(self):
"""Get CLTK's ML taggers, tokenizers, etc."""
orig_files_dir_ling_latin = \
os.path.join(self.orig_files_dir, 'cltk_latin_linguistic_data')
latin_dir = os.path.join(self.cltk_data, 'latin')
if os.path.isdir(latin_dir) is True:
pass
else:
os.mkdir(latin_dir)
latin_dir_ling = os.path.join(latin_dir, 'cltk_linguistic_data')
if os.path.isdir(latin_dir_ling) is True:
pass
else:
os.mkdir(latin_dir_ling)
pg_url = 'https://raw.githubusercontent.com/cltk/cltk_latin_linguistic_data/master/latin.tar.gz'
session = requests.Session()
session.mount(pg_url, SSLAdapter(ssl.PROTOCOL_TLSv1))
pg_tar = session.get(pg_url, stream=True)
ling_latin_file_name = urlsplit(pg_url).path.split('/')[-1]
tar_latin_file_path = os.path.join(orig_files_dir_ling_latin,
ling_latin_file_name)
try:
with open(tar_latin_file_path, 'wb') as new_file:
new_file.write(pg_tar.content)
logging.info('Finished writing %s.', ling_latin_file_name)
try:
shutil.unpack_archive(tar_latin_file_path,
latin_dir_ling)
logging.info('Finished unpacking %s.',
ling_latin_file_name)
except IOError:
logging.info('Failed to unpack %s.',
ling_latin_file_name)
except IOError:
logging.error('Failed to write file %s', ling_latin_file_name)
开发者ID:smargh,项目名称:cltk,代码行数:35,代码来源:compiler.py
示例14: restore
def restore(self, backup_file, message=str(), delay=0):
"""
Restores the backup of the world from the given *backup_file*. If
the backup archive contains the server executable it will be restored
too if necessairy.
Exceptions:
* WorldStartFailed
* WorldStopFailed
* ... shutil.unpack_archive() exceptions ...
"""
# Extract the backup in a temporary directory and copy then all things
# into the EMSM directories.
with tempfile.TemporaryDirectory() as temp_dir:
shutil.unpack_archive(
filename = backup_file,
extract_dir = temp_dir
)
# Stop the world.
was_online = self._world.is_online()
if was_online:
self._world.send_command("say {}".format(message))
time.sleep(delay)
self._world.kill_processes()
# Restore the world.
self._restore_world(temp_dir)
self._restore_world_conf(temp_dir)
# Restart the world if it was online before restoring.
if was_online:
self._world.start()
return None
开发者ID:boranblok,项目名称:emsm,代码行数:34,代码来源:backups.py
示例15: import_yaml
def import_yaml():
'''
import user pre-defined files from ~/xpdUser/Import
Files can be compreesed or .yml, once imported, bt.list() should show updated acquire object list
'''
src_dir = glbl.import_dir
dst_dir = glbl.yaml_dir
f_list = os.listdir(src_dir)
if len(f_list) == 0:
print('INFO: There is no pre-defined user objects in {}'.format(src_dir))
return
# two possibilites: .yml or compressed files; shutil should handle all compressed cases
moved_f_list = []
for f in f_list:
full_path = os.path.join(src_dir, f)
(root, ext) = os.path.splitext(f)
if ext == '.yml':
shutil.copy(full_path, dst_dir)
moved_f_list.append(f)
# FIXME - do we want user confirmation?
os.remove(full_path)
else:
try:
shutil.unpack_archive(full_path, dst_dir)
moved_f_list.append(f)
# FIXME - do we want user confirmation?
os.remove(full_path)
except ReadError:
print('Unrecongnized file type {} is found inside {}'.format(f, src_dir))
pass
return moved_f_list
开发者ID:tacaswell,项目名称:xpdAcq,代码行数:32,代码来源:beamtimeSetup.py
示例16: aurbuild
def aurbuild(package_name):
os.chdir(BUILDFOLDER)
# Get the filename from the URL.
url = "https://aur.archlinux.org/cgit/aur.git/snapshot/{0}.tar.gz".format(package_name)
fileinfo = urllib.parse.urlparse(url)
filename = urllib.parse.unquote(os.path.basename(fileinfo.path))
# Get the file.
urllib.request.urlretrieve(url, filename)
# Extract the file.
shutil.unpack_archive(filename, BUILDFOLDER)
AURFOLDER=BUILDFOLDER+"/"+package_name
subprocess.run("""
chmod a+rwx -R {0}
cd {0}
su {2} -s /bin/bash -c 'makepkg --noconfirm -A -s'
pacman -U --noconfirm ./{1}-*.pkg.tar.xz
""".format(AURFOLDER, package_name, USERNAMEVAR), shell=True)
# Cleanup
os.chdir(BUILDFOLDER)
if os.path.isdir(AURFOLDER):
shutil.rmtree(AURFOLDER)
os.remove(BUILDFOLDER+"/"+filename)
return
开发者ID:vinadoros,项目名称:CustomScripts,代码行数:26,代码来源:Comp-ArchAUR.py
示例17: telecharger_envoi
def telecharger_envoi(self, archive):
"""Intégration d'une archive au sein d'un dossier
"""
tmp = cfg.TMP / motaleatoire(6)
tmp.mkdir()
tmp_archive = tmp / archive.filename
archive.save(str(tmp_archive))
try:
os.chdir(str(tmp))
shutil.unpack_archive(
str(tmp_archive),
extract_dir=str(tmp),
format='zip',
)
tmp_archive.unlink()
dossier = [dss for dss in tmp.iterdir()]
if len(dossier) != 1:
return self.afficher(markdown(_(
"L'archive doit contenir un et un seul dossier, "
"dans lequel doivent se trouver :\n\n"
"- les fichiers du projet ;\n"
"- éventuellement, le dossier `.git` contenant "
"les données de gestion de version."
)))
dossier = dossier[0]
shutil.copytree(str(dossier), str(self.dossier))
if not (self.dossier / '.git').is_dir():
self.depot.initialiser()
b.redirect(i18n_path('/' + self.chemin))
except shutil.ReadError as err:
f.traiter_erreur(err)
return self.afficher(_("Ceci n'est pas une archive zip."))
finally:
os.chdir(str(cfg.PWD))
shutil.rmtree(str(tmp))
开发者ID:musite-project,项目名称:musite,代码行数:35,代码来源:controleur.py
示例18: test_unpack_registery
def test_unpack_registery(self):
formats = get_unpack_formats()
def _boo(filename, extract_dir, extra):
self.assertEquals(extra, 1)
self.assertEquals(filename, 'stuff.boo')
self.assertEquals(extract_dir, 'xx')
register_unpack_format('Boo', ['.boo', '.b2'], _boo, [('extra', 1)])
unpack_archive('stuff.boo', 'xx')
# trying to register a .boo unpacker again
self.assertRaises(RegistryError, register_unpack_format, 'Boo2',
['.boo'], _boo)
# should work now
unregister_unpack_format('Boo')
register_unpack_format('Boo2', ['.boo'], _boo)
self.assertIn(('Boo2', ['.boo'], ''), get_unpack_formats())
self.assertNotIn(('Boo', ['.boo'], ''), get_unpack_formats())
# let's leave a clean state
unregister_unpack_format('Boo2')
self.assertEquals(get_unpack_formats(), formats)
开发者ID:vladistan,项目名称:py3k-__format__-sprint,代码行数:25,代码来源:test_shutil.py
示例19: fetch_data
def fetch_data():
"""
What it expects:
----------------
That the DATA_DIR has been created
What it does:
-------------
Downloads the zip file from the Guardian
Saves it to DATA_DIR
Unzips it into DATA_DIR
What it returns:
----------------
Nothing
"""
resp = requests.get(SRC_URL)
print("Downloading", SRC_URL)
# save the zip file to disk
with open(ZIPPED_DATA_FILENAME, 'wb') as f:
f.write(resp.content)
# unzip the zip file
print("Unzipping", ZIPPED_DATA_FILENAME)
unpack_archive(ZIPPED_DATA_FILENAME, extract_dir=DATA_DIR)
开发者ID:compciv,项目名称:2016.compciv.org,代码行数:25,代码来源:bootstrapping.py
示例20: openFile
def openFile(fileName):
"""
Otevøe soubor fileName vhodným kompresním programem a vrátí otevøený stream.
@result {Stream | None}
"""
fileExtension = fileName[fileName.rfind(".") + 1:].lower()
if fileExtension in UNCOMPRESSED_EXTENSIONS:
return open(fileName)
else:
formats = shutil.get_archive_formats()
for dict in formats:
if fileExtension == dict[0]:
tempDir = "tempDir"
if os.path.exists(tempDir):
shutil.rmtree(tempDir)
shutil.unpack_archive(fileName, tempDir)
onlyfiles = [ f for f in os.listdir(tempDir) if os.path.isfile(os.path.join(tempDir,f)) ]
if onlyfiles == []:
return None
else:
return open(tempDir + '\\' + onlyfiles[0])
pass
return None
开发者ID:raugustyn,项目名称:VFKQualityValidation,代码行数:25,代码来源:CompressTools.py
注:本文中的shutil.unpack_archive函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论