Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Python NameError: name 'file' is not defined

Asked by James Leeming Mar 9, 2021 5.9K views 1 answer
Share

About this question

I am trying to run a speech to text script and here is a part of that code where I am getting an error:

import sys

import argparse

parser = argparse.ArgumentParser()

parser.add_argument('-f', dest=file, type=string)

args = parser.parse_args()

print args.file

But I am getting the following error:

NameError: name 'file_name' is not defined

Your answer

1 Answer

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.