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 5939087
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:46:37+00:00 2026-05-22T15:46:37+00:00

in py_script.py: import os import sys l = len(sys.argv) if l == 1: print

  • 0

in py_script.py:

import os
import sys

l = len(sys.argv) 
if  l == 1:
    print 'no args'
else:
    if l > 1: 
        print 'first arg is %s'%sys.argv[1]
    if l > 2:
        print 'second arg is %s'%sys.argv[2]

now going command-line, on my winXP platform:

d:\path\py_script.py 1 2

yields

first arg is 1
second arg is 2

yet on my Win7 platform I get

no args

If I do

d:\path\python py_script.py 1 2

I get

first arg is 1
second arg is 2

How can I make my Win7 environment act as expected ?

some details:
win7 is 64bit.
py2.6.6 on win7, py 2.6.4 on winXP.

  • 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-22T15:46:37+00:00Added an answer on May 22, 2026 at 3:46 pm

    Based on jtp’s answer.
    Well I messed up with the registry a bit.

    This was what I think are the steps:

    1. doing

      assoc .py=Python.File

    2. through win explorer pick a .py file, right click -> x64 -> open with > browse to c:\Python26\python.exe choose the ‘always open with this..’ box.
      this in effect changes immediately the reg value

      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts.py\UserChoice
      to
      Python.File

    3. set HKEY_CLASSES_ROOT\Python.File\shell\Open\Command to
      “C:\Python26\python.exe” “%1” %2 %3 %4 %5 %6 %7 %8 %9

    note: from previous experience i’m sure things are expected to mess up with mixed versions.
    uninstalling/re-installing shall be the way to go. BTW, I didn’t want to go through that becuase with all the packages including ones I built from source it would be a mess.

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

Sidebar

Related Questions

import socket, sys, string if len(sys.argv) !=4 : print Usage: ./supabot.py <host> <port> <channel>
i have the following script import getopt, sys opts, args = getopt.getopt(sys.argv[1:], h:s) for
I have a script like this: #!/Python26/ # -*- coding: utf-8 -*- import sys
suppose there is a script doing something like this: # module writer.py import sys
In my views.py, I'm building a list of two-tuples, where the second item in
I'm trying to run this script: import re, os def build_pool(cwd): global xtn_pool, file_pool
My current setup.py script works okay, but it installs tvnamer.py (the tool) as tvnamer.py
I've written a setup.py script for py2exe, generated an executable for my python GUI
I've used subversion for a while, and used the svnmerge.py script for a while
I got a message saying script xyz.py returned exit code 0 . What does

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.