Sunday 29 December 2019

GTTS (Google Text-to-Speech) file won't download after deployment

I've tried several different methods with no luck. I posted in a thread that was posted on how to use the package, but it was from too far back to get a response. Here it is, again. $10 tip to anyone who can help with this. Neither the example provided on the github nor the example from the uploader resolve the issue.The file downloads every time, when I use localhost:3000. The file goes into my project directly, even when I specify a path to a different folder. I've deployed to two different places to resolve the issue, and it works on neither (but for different reasons)." I even redid the app with html (rather than ejs) and deployed to github (405 error). When I'm hosting it, the file downloads just as it should. When I do it via Heroku, it goes through the process as if it's working, and redirects to home (which only happens after it's successful), but no file. In the video, no download directory is given, and I read the docs and couldn't figure out how to get that to work. You're supposed to be able to use .save to specify the path and filename, I tried it many different ways and each one failed. The best I got was instead of silently download, it actually popped up in the download history. Normally, it just pops into my main directory, but this time it downloaded like any other file would in my download history, but not so when I re-deployed to Heroku.If anyone has any idea on how to specify the directory or get a prompt asking the user where to download the file, I'd be grateful. https://codeshare.io/2pVPvD (I removed res.download..made no difference, added fs and path to try out several solution that didn't work)Here it is live: https://phrasebooktts.herokuapp.com/Docs:"save(savefile) Do the TTS API request and write result to file. Parameters savefile (string) – The path and file name to save the mp3 to. Raises gTTSError – When there’s an error with the API request.write_to_fp(fp) Do the TTS API request and write bytes to a file-like object. Parameters fp (file object) – Any file-like object to write the mp3 to. "As you can see, I do not have an eye for design, I normally use bootstrap, but I'm forsaking that to get better at CSS in the next few months. Looking forward to getting started, as soon as I resolve this download issue."

Submitted December 30, 2019 at 02:09AM by JSDevNAHalfShell

No comments:

Post a Comment