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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:07:45+00:00 2026-05-26T03:07:45+00:00

I have a script that I’ve been using for a some time to easily

  • 0

I have a script that I’ve been using for a some time to easily upload files to my server. It has been working great for a long time, but I can’t get it to work on my new desktop computer.

The code is simple:

import os.path
import sys
import os
from ftplib import FTP

host = ""
acc = ""
pw = ""
filepath = sys.argv[1]

if (not os.path.isfile(filepath)):
    x = input("ERROR, invalid filepath")
    exit()

filename = os.path.basename(filepath)
file_object = open(filepath, 'rb')

ftp = FTP(host)
ftp.login(acc, pw)
ftp.storbinary('STOR ' + filename, file_object)
ftp.quit()

file_object.close()

I run it as:

file_uploader.py backup.sql

I get the following error:

Traceback (most recent call last):

File "C:\Users\Admin\Desktop\file_uploader.py", line 12, in

filepath = sys.argv[1]

IndexError: list index out of range

I’m not sure why it’s giving me an error that it can’t find the first commandline argument even though I passed one to the script.

I am running Windows 7 64-bit with Python 2.7.2

Thanks

  • 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-26T03:07:46+00:00Added an answer on May 26, 2026 at 3:07 am

    Your .py association in the registry is incorrect. It’s missing %* at the end.

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

Sidebar

Related Questions

I have a script that works fine on my test server (using IIS6). The
I have script that takes long time to execute. In a result server responds
I have a script that retrieves objects from a remote server through an Ajax
I have a script that checks responses from HTTP servers using the PEAR HTTP
I have this script that I am currently running that works great for all
I have a script that has a GET variable: $_GET['percentage'] I have a MySQL
I have a script that generates a csv file using the following code: header('Content-type:
I currently have script that slides down a once the page has loaded. So
Have a script that using jquery validation. Tested on 2 Blackberry's and neither worked
I have a script that records files with UTF8 encoded names. However the script's

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.