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
Databricks Employee
Databricks Employee

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 Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now