Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if thumb_req.status_code == 200:
thumb_extension = 'gif'
thumb_path = thumb_path[:-4]+'.gif'
retcode = 0
if not retcode:
with open(thumb_path, 'wb') as thumb_f:
thumb_f.write(thumb_req.content)
# Generate thumbnail
if not retcode or only_use_existing:
pass
elif extension == 'ipynb':
verb = 'Successfully generated'
print('getting thumbnail code for %s' % os.path.abspath(f))
print('Path exists %s' % os.path.exists(os.path.abspath(f)))
code = notebook_thumbnail(os.path.abspath(f), dest_dir)
code = script_prefix + code
my_env = os.environ.copy()
retcode = execute(code.encode('utf8'), env=my_env, cwd=os.path.split(f)[0])
else:
retcode = 1
if retcode:
logger.info('%s thumbnail export failed' % basename)
if extension == 'py':
continue
thumb_prefix = '_'.join([pre for pre in (section, backend) if pre])
backend_str = backend+'_' if backend else ''
if thumb_prefix:
thumb_prefix += '_'
this_entry = THUMBNAIL_TEMPLATE.format(
backend=backend_str, prefix=thumb_prefix, thumbnail=logo_path,