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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:48:55+00:00 2026-06-14T17:48:55+00:00

I am calling a function to get the file a user selects in a

  • 0

I am calling a function to get the file a user selects in a simple gui. I am trying to determine the proper way to continue prompting the user until they select a file. Right now my call is:

    file_path = None 
    while file_path is None:
        file_path = input_text_file()   # calls function to prompt user

Is there a better way to do this without initially setting file_path to None? Is there a way to loop until a value is returned, or something along those lines?

  • 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-14T17:48:56+00:00Added an answer on June 14, 2026 at 5:48 pm

    If this is part of some form or wizard that requires the user to select a file, then you could simply check the value of file_path when the user clicks the continue or next button and if they have not selected a file then notify them in some way that they need to do so. This would not remove the need to set file_path = None but it would remove the while loop. If your set on just looping until a file is selected your way or lenik’s would work fine. Unless your doing some kind of dynamic updating of a part of your GUI based on the file selected then there may not be a need for the loop, but I don’t have enough info to be able to make that assumption.

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

Sidebar

Related Questions

I'm trying to return a value from (transport) to the calling function, but can't
I have a simple user signup form with a checkbox that lets users get
what I am trying to do: If the user specifies return_length=True when calling your
Does anyone know how to watch a variable in calling function. For example: C#:
Possible Duplicate: calling ASP function from javascript okay running this code : <script type=text/javascript>
I am calling a function funcB from funcA . funcB uses several printf statements
I'm calling a function from an input radio button and have this: onClick=\changeBilling('.$results['id'].', this.value)\
I'm calling a function and adding a listener for when the function returns some
Suppose you are calling a function, where there's clearly a need to break down
I am calling a function in my controller from a button click .... I

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.