Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Python Tool errors only when scheduled

mstockton
6 - Meteoroid

Hi all -

 

I have a flow set up to turn off the 1904 date setting in Excel documents in a folder (attached). The intention behind this flow is to schedule it to run hourly so that we can run other scheduled workflows off of that folder and all files will read in successfully. 

 

This flow works fine when run manually. You input the file path into the text input, and the python tool iterates through all files in the folder and turns off the 1904 date setting where applicable.

However, this flow will not run when scheduled. The errors I get are inconsistent; sometimes it's a Permission Error, sometimes it seems to have to do with package installation.

 

Find below two examples of errors after runs. The second one is clearly related to permissions, but I'm not sure why it would pop up when scheduled and not when run manually. The other one appears to be related to the 

Error: Tool #1: Traceback (most recent call last):
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Alteryx\bin\Miniconda3\envs\DesignerBaseTools_venv\Scripts\jupyter-nbconvert.EXE\__main__.py", line 7, in <module>
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
    app.start()
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\nbconvertapp.py", line 338, in start
    self.convert_notebooks()
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\nbconvertapp.py", line 508, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\nbconvertapp.py", line 479, in convert_single_notebook
    output, resources = self.export_single_notebook(notebook_filename, resources, input_buffer=input_buffer)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\nbconvertapp.py", line 408, in export_single_notebook
    output, resources = self.exporter.from_filename(notebook_filename, resources=resources)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\exporters\exporter.py", line 179, in from_filename
    return self.from_file(f, resources=resources, **kw)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\exporters\exporter.py", line 197, in from_file
    return self.from_notebook_node(nbformat.read(file_stream, as_version=4), resources=resources, **kw)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\exporters\notebook.py", line 32, in from_notebook_node
    nb_copy, resources = super(NotebookExporter, self).from_notebook_node(nb, resources, **kw)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\exporters\exporter.py", line 139, in from_notebook_node
    nb_copy, resources = self._preprocess(nb_copy, resources)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\exporters\exporter.py", line 316, in _preprocess
    nbc, resc = preprocessor(nbc, resc)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\preprocessors\base.py", line 47, in __call__
    return self.preprocess(nb, resources)
  File "c:\program files\alteryx\bin\miniconda3\envs\designerbasetools_venv\lib\site-packages\nbconvert\preprocessors\execute.py", line 383, in preprocess
    nb.metadata['language_info'] = info_msg['content']['language_info']
KeyError: 'language_info'

 

 

Error: Tool #1: ---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
<ipython-input-2-5d0c12328af7> in <module>
     15 ayxDat = Alteryx.read('#1')
     16 folder_path = ayxDat['folder_path'][0]
---> 17 turn_off_1904_date_setting(folder_path)
<ipython-input-2-5d0c12328af7> in turn_off_1904_date_setting(folder_path)
      4 
      5 def turn_off_1904_date_setting(folder_path):
----> 6     for filename in os.listdir(folder_path):
      7         if filename.endswith('.xlsx'):
      8             file_path = os.path.join(folder_path, filename)
PermissionError: [WinError 5] Access is denied: '\\\\YourFilePathGoesHere\\Subfolder'

 

Any ideas on how to resolve this so that I can schedule this flow?

 

Thanks all!

3 REPLIES 3
DavidSkaife
13 - Pulsar

Hi @mstockton 

 

For the permissions error this can happen when Alteryx Server has not got the same permissions as the user, in this case it looks like the account used to run the scheduled workflows doesn't have access to the folder. You'll need to ensure the account(s) that are used when running scheduled workflows on the Server have the same access permissions to that folder as the user (in this case yourself).

 

The second error is a little more tricky, while it saying that it cannot access a key that doesn't exist in a dictionary it looks like its an issue on Python side, on the server, rather than anything to do with your code.

 

You might have to do some testing once you get the permissions issue resolved, which may also resolve it if you're lucky!

 

Hope that helps!

mstockton
6 - Meteoroid

Most of the time I'm getting the permissions error, just maybe 1 in 10 times it switches to the other one. So if I can get the permissions error cleared, I think it might work.

 

This may be a dumb question, but do you know how i can identify the user for the Alteryx scheduler? 

DavidSkaife
13 - Pulsar

Hi @mstockton 

 

It entirely depends on your Server setup (assuming you're scheduling via the Server and not the old desktop scheduler?)

 

The default account on where the Server is installed will be the 'User' that runs all the scheduled workflows, but you can also run as different users depending on how everything is setup. For example you can run the 'Worker' as a different user, and even have multiple workers if your setup is large enough.

 

To identify and set the required permissions you'd have to speak to your IT department to find out if its the default 'User' or another one, which can be found in the System Settings of the server (see screenshot below). Once identified they need to be given the right read/write access to the folder(s) required to run the workflow without errors.

 

 

Capture.PNG

Labels