[issue20840] AttributeError: 'module' object has no attribute 'ArgumentParser'
New submission from bsduni: Hi! I have installed Python 2.7.6 fully (all the modules selected). I attempted run some Python codes that were developed by a past staff, and am stuck with an issue with argparse. For ease of explanation I am using the example given in this website at http://docs.python.org/2/howto/argparse.html. When I create a simple program prog.py with codes below: import argparse parser = argparse.ArgumentParser() parser.parse_args() and execute with $ python prog.py, the following is the error message I receive: Traceback (most recent call last): File "prog.py", line 2, in parser = argparse.ArgumentParser() AttributeError: 'module' object has no attribute 'ArgumentParser' I also tried to add argparse additionally using pip install and the problem remains the same. Would be grateful if someone could help to overcome this AttributeError. -- components: Extension Modules messages: 212620 nosy: bsduni priority: normal severity: normal status: open title: AttributeError: 'module' object has no attribute 'ArgumentParser' type: behavior versions: Python 2.7 ___ Python tracker <http://bugs.python.org/issue20840> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20840] AttributeError: 'module' object has no attribute 'ArgumentParser'
bsduni added the comment: Unfortunately it is not that case, ie, no argparse in my current working directory /home/bsduni/pytests/ (on a FreeBSD 9.2 system). The following are the locations I can find argparse in my system: /usr/local/lib/python2.7/argparse.py /usr/local/lib/python2.7/argparse.pyo /usr/local/lib/python2.7/argparse.pyc /usr/ports/lang/python27/work/Python-2.7.6/Doc/howto/argparse.rst /usr/ports/lang/python27/work/Python-2.7.6/Doc/library/argparse.rst /usr/ports/lang/python27/work/Python-2.7.6/Lib/argparse.py /usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/argparse.py /usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/argparse.pyc /usr/ports/lang/python27/work/stage/usr/local/lib/python2.7/argparse.pyo /usr/local/lib/python2.7/site-packages/IPython/external/argparse /usr/local/lib/python2.7/site-packages/argparse.py /usr/local/lib/python2.7/site-packages/argparse.pyc /usr/local/lib/python2.7/site-packages/argparse-1.1-py2.7.egg-info /usr/local/lib/python2.7/site-packages/argparse /usr/local/lib/python2.7/site-packages/argparse_actions /usr/local/lib/python2.7/site-packages/argparse_actions-0.4.4-py2.7.egg-info /usr/local/lib/python2.7/site-packages/argparse_config /usr/local/lib/python2.7/site-packages/argparse_config-0.5.1-py2.7.egg-info /usr/local/lib/python2.7/site-packages/argparse.extra-0.0.2-py2.7.egg-info /usr/local/lib/python2.7/site-packages/argparse.extra-0.0.2-py2.7-nspkg.pth The the files in /usr/local/lib/python2.7/site-packages/ are from the 'pip install' which I tried when argparse didnot work after the installation of Python in full (ie, with argparse files in /usr/local/lib/python2.7/) -- ___ Python tracker <http://bugs.python.org/issue20840> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com