Posts

Showing posts with the label google-cloud-speech

Bad:Can't finish “os.path.dirname(__file)” in ubuntu (python)(google cloud speech)

Image
Clash Royale CLAN TAG #URR8PPP Bad:Can't finish “os.path.dirname(__file)” in ubuntu (python)(google cloud speech) thanks for helping me! I just set up google cloud speech and tried to run the code in "Make an audio transcription request" in this website: Quickstart: Using Client Libraries the code is shown below after I open ubuntu terminal: export GOOGLE_APPLICATION_CREDENTIALS="/home/luffy/Lumariatuan-xxxxxxxxxxxx.json" python import io import os from google.cloud import speech from google.cloud.speech import enums from google.cloud.speech import types client = speech.SpeechClient() # The name of the audio file to transcribe file_name = os.path.join( os.path.dirname(__file__), 'resources', 'audio.raw') However, when I run the last part os.path.dirname(__file) in Ubuntu 18.04 terminal in python , the error happens like below: os.path.dirname(__file) * NameError: name '__file__' is not defined* How can I solve the p...