Skip to content

Commit 1c63b5b

Browse files
authored
Merge pull request #111103 from Bowen-Guo/bowguo/execute_python_script
Update doc of Module Execuete Python Script to reduce user error
2 parents 04151e4 + 2496a42 commit 1c63b5b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

articles/machine-learning/algorithm-module-reference/execute-python-script.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ The following example shows how to upload an image file in the **Execute Python
159159
# imports up here can be used to
160160
import pandas as pd
161161

162-
# The entry point function can contain up to two input arguments:
162+
# The entry point function must have two input arguments:
163163
# Param<dataframe1>: a pandas.DataFrame
164164
# Param<dataframe2>: a pandas.DataFrame
165165
def azureml_main(dataframe1 = None, dataframe2 = None):
@@ -212,10 +212,17 @@ The **Execute Python Script** module contains sample Python code that you can us
212212

213213
5. In the **Python script** text box, type or paste valid Python script.
214214

215+
> [!NOTE]
216+
> Please be very careful when writing your script and make sure there is no syntax error, such as using a un-declared object or a un-imported module. Also pay extra attentions to the pre-installed module list. To import modules which are not listed, install the corresponding packages in your script such as
217+
> ``` Python
218+
> import os
219+
> os.system(f"pip install scikit-misc")
220+
> ```
221+
215222
The **Python script** text box is pre-populated with some instructions in comments, and sample code for data access and output. You must edit or replace this code. Be sure to follow Python conventions about indentation and casing.
216223

217224
+ The script must contain a function named `azureml_main` as the entry point for this module.
218-
+ The entry point function can contain up to two input arguments: `Param<dataframe1>` and `Param<dataframe2>`
225+
+ The entry point function must have two input arguments: `Param<dataframe1>` and `Param<dataframe2>`, even when these arguments are not used in your script.
219226
+ Zipped files connected to the third input port are unzipped and stored in the directory, `.\Script Bundle`, which is also added to the Python `sys.path`.
220227

221228
Therefore, if your zip file contains `mymodule.py`, import it using `import mymodule`.

0 commit comments

Comments
 (0)