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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:07:00+00:00 2026-06-08T00:07:00+00:00

I have the code below in my Python script: def cmd_wui(argv, path_to_tx): Run a

  • 0

I have the code below in my Python script:

def cmd_wui(argv, path_to_tx):
    """Run a web UI."""
    from flask import Flask, flash, jsonify, render_template, request
    import webbrowser
    app = Flask(__name__)


    @app.route('/tx/index/')
    def index():
        """Load start page where you select your project folder
        or load history projects from local DB."""
        from txclib import get_version
        txc_version = get_version()
        prj = project.Project(path_to_tx)

        # Let's create a resource list from our config file
        res_list = []
        prev_proj = ''
        for idx, res in enumerate(prj.get_resource_list()):
                hostname = prj.get_resource_host(res)
        username, password = prj.getset_host_credentials(hostname)
        return render_template('init.html', txc_version=txc_version, username=username)

Also, I have an HTML form in init.html:

<form>
<input type="text" id="projectFilepath" size="40" placeholder="Spot your project files">
<input type="button" id="spotButton" value="Spot">
</form>

How can I pass the user input from “projectFilepath” when a user clicks “spotButton” on a variable in my python script?

I’m new in Python and Flask, so forgive me if I make any mistakes.

  • 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-08T00:07:02+00:00Added an answer on June 8, 2026 at 12:07 am

    The form tag needs some attributes set:

    1. action: The URL that the form data is sent to on submit. Generate it with url_for. It can be omitted if the same URL handles showing the form and processing the data.
    2. method="post": Submits the data as form data with the POST method. If not given, or explicitly set to get, the data is submitted in the query string (request.args) with the GET method instead.
    3. enctype="multipart/form-data": When the form contains file inputs, it must have this encoding set, otherwise the files will not be uploaded and Flask won’t see them.

    The input tag needs a name parameter.

    Add a view to handle the submitted data, which is in request.form under the same key as the input’s name. Any file inputs will be in request.files.

    @app.route('/handle_data', methods=['POST'])
    def handle_data():
        projectpath = request.form['projectFilepath']
        # your code
        # return a response
    

    Set the form’s action to that view’s URL using url_for:

    <form action="{{ url_for('handle_data') }}" method="post">
        <input type="text" name="projectFilepath">
        <input type="submit">
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to import one python script from another. I have a few
Consider the code below: #!/usr/bin/env python from PyQt4 import QtCore, QtGui import os,sys class
I have a python psp page code is shown below. Currently it only prints
I have the code below ; import cv import time cv.NamedWindow(camera, 1) capture =
I am trying to run a shell from my python program. I have used
I have a python script that is constantly grabbing data from Twitter and writing
I have a web crawling python script running in terminal for several hours, which
I am carrying out code maintenance on an old Python script. I have come
I have python code below that will loop through a table and print out
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server

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.