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

  • SEARCH
  • Home
  • 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 8411509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:26:14+00:00 2026-06-10T00:26:14+00:00

I like to give my user’s an example in my __doc__ usage string. Here

  • 0

I like to give my user’s an example in my __doc__ usage string. Here are the important parts of the code relating to my question.

# jmetadata.py
'''
usage:     jmetadata.py inDirPath outFilePath
example:   jmetadata.py "\\\\Hal\\hal free agent 1\\backups\\videos\\" out.txt
'''

<...deleted code...>

def forPyWinTests():
    jmetadata("\\\\Hal\\hal free agent 1\\backups\\videos\\", "out.txt")

NUM_ARGS = 2
def main():
    args = sys.argv[1:]
    print args
    if len(args) != NUM_ARGS or "-h" in args or "--help" in args:
        print __doc__
        sys.exit(2)
    jmetadata(args[0], args[1])

if __name__ == '__main__':
    main()
    # print()
    # forPyWinTests()

I EXPECT this behaviour:

>jmetadata.py
[]

usage:     jmetadata.py inDirPath outFilePath
example:   jmetadata.py "\\Hal\hal free agent 1\backups\videos\" out.txt


>

However, when I copy the example to the command line I EXPECT the program to RUN. Instead I get:

>jmetadata.py "\\Hal\hal free agent 1\backups\videos\" out.txt
['\\\\Hal\\hal free agent 1\\backups\\videos" out.txt']

usage:     jmetadata.py inDirPath outFilePath
example:   jmetadata.py "\\Hal\hal free agent 1\backups\videos\" out.txt

Note the SECOND LINE in the above. That results from the print args command inside main(). It is saying that the args list has only 1 element, ['\\\\Hal\\hal free agent 1\\backups\\videos" out.txt'], instead of 2. This doesn’t make sense to me.

I have done a bit more investigation by writing a windows .cmd file. Here is show_args.cmd:

rem show_args.cmd
echo %1 
echo %2

Here is the result of a run:

>show_args.cmd "\\Hal\hal free agent 1\backups\videos\" out.txt

>rem show_args.cmd

>echo "\\Hal\hal free agent 1\backups\videos\"
"\\Hal\hal free agent 1\backups\videos\"

>echo out.txt
out.txt

Windows seems to separate the items. I am stumped. Does anyone know what’s goin on here?

I hope someone has some insight to share. Thanks in advance.

  • 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-06-10T00:26:15+00:00Added an answer on June 10, 2026 at 12:26 am

    Try removing the trailing backslash. Change this:

    jmetadata.py "\\Hal\hal free agent 1\backups\videos\" out.txt
    

    to this:

    jmetadata.py "\\Hal\hal free agent 1\backups\videos" out.txt
    

    In your test run above, the arguments seen by Python are:

    ['\\\\Hal\\hal free agent 1\\backups\\videos" out.txt']
    

    The trailing backspace is being interpreted as an escape character since it is immediately preceding a ", which turns your arguments into a single string (or until an unescaped " is encountered).

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

Sidebar

Related Questions

I would like to give the user a file browser from within a webpage.
I would like to give the user the ability to insert custom elements in
I'm developing a website in PHP and I'd like to give the user to
I would like to give the user the choice to copy files onto the
I would like to give my user's the option to nicely format their comments.
I'd like to give a user the option of making SQL queries. I placed
I would like to give the user the ability to return to a previous
I would like to give user option to select text file locale. Is there
I am working on a project where we would like to give the user
I'm creating a registration page and I would like to give the user the

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.