cancel
Showing results for 
Search instead for 
Did you mean: 
missing-QuestionPost
cancel
Showing results for 
Search instead for 
Did you mean: 

A simple Python command on Databricks selection = input("Enter value") doesn't create a window box to enter the value. Searching reasons on the User Interface or other?

chico
New Contributor II
 
3 REPLIES 3

User16539034020
Contributor II
Contributor II

Hi, Chico:

In Databricks notebooks, input() function calls won't work as you might expect from running Python in other environments. Because Databricks notebooks are using Spark. They're not intended to interact with users in real-time, such as taking keyboard inputs.

There is alternative way: Databricks has a feature called "widgets". Widgets are interactive HTML forms that can be embedded within Databricks notebooks. Here is the example:

dbutils.widgets.text("inputs", '{"name":"Monica, "company":"Databricks"}')
inputs = dbutils.widgets.get("inputs")

Reference doc: https://docs.databricks.com/dev-tools/databricks-utils.html

Hello

I should nave clarified: this a Pyspark environnment not just a Python one.

The issue relies in the cluster settings as taking an other one provides the expected outcome. What is sspecific in my initial cluter SFC ?

Thanks

Anonymous
Not applicable

Hi @stephane cochet​ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!