Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6590437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:17:56+00:00 2026-05-25T17:17:56+00:00

I installed python2.7 on a Solaris server, and am working on a Python script

  • 0

I installed python2.7 on a Solaris server, and am working on a Python script using argparse to retrieve command line options.

Everything worked greate until I started using subparsers. The script fails giving this error:

AttributeError: 'ArgumentParser' object has no attribute 'add_subpasers'

Here’s a short copy of the script:

def main():
    parser = argparse.ArgumentParser(prog="myProg") 
    subparsers = parser.add_subpasers (title="actions", description="list of available actions", help="additional help")


    parser.add_argument("-v", "--verbose",              \
                        action="store_const",           \
                        dest="VERBOSE",                 \
                        default=False,                  \
                        const=True,                     \
                        help="runs in verbose mode")

    parser.add_argument("-V", "--version",                      \
                        action="version",                       \
                        version="myProg 0.1",                   \
                        help="prints the version number")

    parser.add_argument("-z",                                               \
                        type = file,                                        \
                        required = True,                                    \
                        dest = "CONF_FILE",                                 \
                        help = "defines the configuration file")


    parser.add_argument("-f",                                               \
                        type = file,                                        \
                        required = True,                                    \
                        dest = "ENV_FILE",                                  \
                        help = "defines the env definition file")

    parser.add_argument("-e",                                                       \
                        dest = "target_env",                                        \
                        default = None,                                             \
                        help = "limits actions to a specific service. (Optional)")



    parser_launch = subparsers.add_parser ("launch", help = "launches the environment")
    parser_create = subparsers.add_parser ("create", help = "creates the environment")
    parser_create.add_argument ("-p", type = int, help = "passes the necessary parameters for creation")

    pymss_namespace = parser.parse_args()

Any idea why? Thank you very much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:17:56+00:00Added an answer on May 25, 2026 at 5:17 pm

    line 2: you wrote parser.add_subpasers instead of parser.add_subparsers…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working in python 2.6 (installed alongside Python2.4.3 required for CentOS) and I
My CentOS 5.5 server has both Python 2.4 and Python 2.7 installed (to /opt/python2.7.2
I'm using virtualenv-1.4.5 on Mac OS X 10.6.2 (Xcode is installed) and Python 2.6.
I've installed pydev to my eclipse 3.5.2. Everything was working smoothly, create projects, execute,
We've installed mercurial 1.4.1 and python 2.6.2 on a solaris 8 box. Now some
I am getting this error: /sw/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py:235: UserWarning: Python is not installed as a framework.
I just installed OS X Lion, so I had to reinstall everything for Python2.7.
I am using a Twitter Python package which is installed by easy_install twitter The
I have python 2.7 installed in /opt/python2.7 . Now i want to install the
I am trying to install cvs2svn on a Solaris 10 machine. It has Python

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.