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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T20:06:48+00:00 2026-06-18T20:06:48+00:00

name = raw_input() ftp = FTP() ftp.login(”,”) #These work fine ftp.storbinary(STOR, %s.txt % (name))

  • 0
    name = raw_input()
    ftp = FTP("")
    ftp.login('','')  #These work fine
    ftp.storbinary("STOR", "%s.txt" % (name)) # I think the issue is here
    ftp.quit()

The program always crashes as it reaches this part, I googled and was unable to find an answer, I have even tried just typing the name of the file, but with the same result.

What am I doing wrong?

  • 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-18T20:06:49+00:00Added an answer on June 18, 2026 at 8:06 pm

    If you take a look at the docs, the storbinary method takes the form of ('STOR filename', <file_object>). The issue above is that you don’t have a complete STOR command as your first (command) argument. Since you need to pass an open file handler as the file argument, you could try something like:

    ftp.storbinary("STOR %s.txt" % (name), open("%s.txt" % name, 'rb'))
    

    Which would create an open file handler based on the name from raw_input (as you’re accepting input, you’d want to be wary of malicious input as well). Assuming you handle that, a context manager could be used to open the file (and ensure it closes):

    my_file = "%s.txt" % name
    with open(my_file, "rb") as f:
        ftp.storbinary("STOR %s" % (my_file), f)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now, here is my code: name = raw_input(Please enter your name: ) nameList
Here's my code: start_j = raw_input('Enter a name: ') start_j = start.replace(A, J) start_j
name = raw_input(Welcome soldier. What is your name? ) print('Ok,', name, ' we need
In Python 2: raw_input() In Python 3, I get an error: NameError: name 'raw_input'
I'm getting a keyerror exception when I input a player name here that is
def ask(): global name, loca print What's your name? name = raw_input('> ') print
Manual says To download a file, use ftp.retrlines('RETR ' + filename) Here is what
def askme(answers): question = raw_input(Do you want to see my name, age or favorite
Name: <%= Html.TextBox(txtName, 20, new { @class = hello }) %> I want that
id name mydate 1 co 2011-02-10 07:25:02 2 Carl 2011-02-10 07:26:02 . . .

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.