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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:52:23+00:00 2026-06-14T08:52:23+00:00

I need to create a skip function in python which skips my download code

  • 0

I need to create a skip function in python which skips my download code if the file already exists.

How the function should work:
(If the file exists then no need to run this code, just skip to next code.
And if it doesn’t exist then run this code and then run the next code)

    Filecheck = os.path.join(OUTPUT_FOLDER,"test"+version+"exe")
    print Filecheck

    if not os.path.exists(Filecheck):


     base_url = urlJoin(LINK, + version + "_multi.exe")
     print base_url

     filename2 = "%s_%s_.exe" % (software.capitalize(),version)
     original_filename = os.path.join(OUTPUT_FOLDER, filename2)


     if writeFile(original_filename, httpRequestFile(base_url), "wb") and os.path.exists(original_filename):
        print "Download done"
  • 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-14T08:52:25+00:00Added an answer on June 14, 2026 at 8:52 am
    if not os.path.exists(<path-to-file>):
        download_file()
    

    I’m guessing this is what you mean, though it’s very hard to tell.

    filename = "%s_%s_.exe" % (software.capitalize(),version)
    if not os.path.exists(os.path.join(OUTPUT_FOLDER, filename)):
        base_url = urlJoin(LINK, + version + "_multi.exe")
        writeFile(original_filename, httpRequestFile(base_url), "wb")
    

    FYI if you use requests you don’t need httpRequestFile, so you can simplify your code to:

    import requests
    from urllib2 import urljoin
    filename = "%s_%s_.exe" % (software.capitalize(),version)
    if not os.path.exists(os.path.join(OUTPUT_FOLDER, filename)):
        with open(filename, "wb") as fp:
            fp.write(requests.get(urljoin(LINK, version + "_multi.exe")).content)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a pyramid using asterisks. I specify a value which becomes
I am trying to create a file with PHP here is my code: $file_to_send
I need to create a 10 second timeout on this part of the code
I need to parse HTML fragments, by which I mean the files lack <html>,
I have some JSF code that currently works (as shown below), and I need
I have the following python code: import pty import subprocess os=subprocess.os from subprocess import
I have a container element in which I create on the fly/place() a form,
I have a linq query in which I need to specifically do a left
I need to create a figure window with two plots at the same time.
I need to create safe filenames on Windows (with support for foreign language chars).

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.