It's already in memory, and we're going to use it again immediately.
Avoiding the flush-to-disk is both more efficient, and easier to clean
up.
You should be able to simply double click the file in Windows
"""
You should be able to simply double click the file in Windows
"""
+try: # Python 3
+ from io import BytesIO as _BytesIO
+except ImportError: # Python 2
+ from StringIO import StringIO as _BytesIO
"""Download and install the nano text editor"""
url = "http://www.nano-editor.org/dist/v2.2/NT/nano-2.2.6.zip"
r = requests.get(url)
"""Download and install the nano text editor"""
url = "http://www.nano-editor.org/dist/v2.2/NT/nano-2.2.6.zip"
r = requests.get(url)
- output_file = open('nano.zip', 'wb')
- output_file.write(r.content)
- output_file.close()
- nano_zip = zipfile.ZipFile('nano.zip')
+ nano_zip_content = _BytesIO(r.content)
+ nano_zip = zipfile.ZipFile(nano_zip_content)
nano_files = ['nano.exe', 'cygwin1.dll', 'cygintl-8.dll',
'cygiconv-2.dll', 'cyggcc_s-1.dll']
for file_name in nano_files:
nano_zip.extract(file_name, '.')
shutil.move(file_name, python_scripts_directory)
nano_files = ['nano.exe', 'cygwin1.dll', 'cygintl-8.dll',
'cygiconv-2.dll', 'cyggcc_s-1.dll']
for file_name in nano_files:
nano_zip.extract(file_name, '.')
shutil.move(file_name, python_scripts_directory)
def create_ipython_entry_point(python_scripts_directory):
"""Creates a terminal-based IPython entry point for msysgit"""
def create_ipython_entry_point(python_scripts_directory):
"""Creates a terminal-based IPython entry point for msysgit"""