Skip to content

Instantly share code, notes, and snippets.

@lebalz
Last active October 10, 2020 12:51
Show Gist options
  • Save lebalz/a84af116415d0197a7ed048af8714bed to your computer and use it in GitHub Desktop.
Save lebalz/a84af116415d0197a7ed048af8714bed to your computer and use it in GitHub Desktop.
def save(self, savefile):
"""Do the TTS API request and write result to file.
Args:
savefile (string): The path and file name to save the ``mp3`` to.
Raises:
:class:`gTTSError`: When there's an error with the API request.
"""
from pathlib import Path
savefile = Path(savefile)
savefile = str(Path(get_ipython().home_dir, savefile.name))
with open(str(savefile), 'wb') as f:
self.write_to_fp(f)
log.debug("Saved to %s", savefile)
@lebalz
Copy link
Author

lebalz commented Oct 10, 2020

used to make sure a user is writing to it's own user space within jupyterhub...

locate the path of tts.py with

sudo -E pip show gTTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment