python - Cannot import module when using memory_profiler -
i'm trying use memory_profiler, run problem isolated in example.py:
#! /usr/bin/env python import argparse def parse_args(): parser = argparse.argumentparser(description='dummy description') parser.add_argument('--option', action='store_true') return parser.parse_args() if __name__ == '__main__': parse_args()
so using argparse. standalone runs fine (i have python3.3). however, when issue
$ python -m memory_profiler example.py
i error:
nameerror: global name 'argparse' not defined
furthermore if put line
parser = argparse.argumentparser(description='dummy description')
underneath
if __name__ == '__main__':
and comment out function call parse_args(), don't error.
anyone idea goes wrong here?
Comments
Post a Comment