diff --git a/IPython/html/nbconvert/tests/test_nbconvert_handlers.py b/IPython/html/nbconvert/tests/test_nbconvert_handlers.py
index ffeb72367..88ff3a7d5 100644
--- a/IPython/html/nbconvert/tests/test_nbconvert_handlers.py
+++ b/IPython/html/nbconvert/tests/test_nbconvert_handlers.py
@@ -67,7 +67,7 @@ class APITest(NotebookTestBase):
with io.open(pjoin(nbdir, 'foo', 'testnb.ipynb'), 'w',
encoding='utf-8') as f:
- write(f, nb, version=4)
+ write(nb, f, version=4)
self.nbconvert_api = NbconvertAPI(self.base_url())
diff --git a/IPython/html/services/contents/filemanager.py b/IPython/html/services/contents/filemanager.py
index cd077f171..81e36c6d1 100644
--- a/IPython/html/services/contents/filemanager.py
+++ b/IPython/html/services/contents/filemanager.py
@@ -303,7 +303,7 @@ class FileContentsManager(ContentsManager):
nb['metadata']['name'] = u''
with atomic_writing(os_path, encoding='utf-8') as f:
- nbformat.write(f, nb, version=nbformat.NO_CONVERT)
+ nbformat.write(nb, f, version=nbformat.NO_CONVERT)
def _save_file(self, os_path, model, name='', path=''):
"""save a non-notebook file"""
diff --git a/IPython/html/services/contents/tests/test_contents_api.py b/IPython/html/services/contents/tests/test_contents_api.py
index c2ef6a107..b62dbb39e 100644
--- a/IPython/html/services/contents/tests/test_contents_api.py
+++ b/IPython/html/services/contents/tests/test_contents_api.py
@@ -144,7 +144,7 @@ class APITest(NotebookTestBase):
with io.open(pjoin(nbdir, d, '%s.ipynb' % name), 'w',
encoding='utf-8') as f:
nb = new_notebook()
- write(f, nb, version=4)
+ write(nb, f, version=4)
# create a text file
with io.open(pjoin(nbdir, d, '%s.txt' % name), 'w',
diff --git a/IPython/html/services/sessions/tests/test_sessions_api.py b/IPython/html/services/sessions/tests/test_sessions_api.py
index ad5ef717a..4090c3488 100644
--- a/IPython/html/services/sessions/tests/test_sessions_api.py
+++ b/IPython/html/services/sessions/tests/test_sessions_api.py
@@ -64,7 +64,7 @@ class SessionAPITest(NotebookTestBase):
with io.open(pjoin(nbdir, 'foo', 'nb1.ipynb'), 'w',
encoding='utf-8') as f:
nb = new_notebook()
- write(f, nb, version=4)
+ write(nb, f, version=4)
self.sess_api = SessionAPI(self.base_url())
diff --git a/IPython/html/tests/test_files.py b/IPython/html/tests/test_files.py
index 4c75f5b13..51a8d0317 100644
--- a/IPython/html/tests/test_files.py
+++ b/IPython/html/tests/test_files.py
@@ -74,7 +74,7 @@ class FilesTest(NotebookTestBase):
with io.open(pjoin(nbdir, 'testnb.ipynb'), 'w',
encoding='utf-8') as f:
- write(f, nb, version=4)
+ write(nb, f, version=4)
with io.open(pjoin(nbdir, 'test.bin'), 'wb') as f:
f.write(b'\xff' + os.urandom(5))