Python error handling

Screen Link:

My Code:

1)from ayx import package
2)from ayx import Alteryx"#1")
3)from ayx import Alteryx
import shutil

What I expected to happen:
to exit when no fileName

What actually happened:

error message at step 2 --Error : unable to read data....

Can we modify the program to exit when there is no fileName(i.e when there is file on shared drive) instead of error and cotinue flow i.e move file when there fileName (i.e when file exists on shared drive)

I don’t understand the details of your code. Please make it actual Python code, without the numbering and other weird stuff.

Hi Bruno - Am I missing something here ? Image attached in exception handling.
Any hints appreciated

this is in my second cell
— Start of Code—

from ayx import Alteryx
import sys


----End of Code

I won’t speak for Bruno, but you seem to be working with a library/tool that most people in this community won’t have experience with.

As per the limited documentation here - Python Tool | Alteryx Help


Is meant to access some form of connection. And as per Build Workflows | Alteryx Help you are supposed to create that connection through the Alteryx tool so that you can then open it up and access the data in python. I might be mistaken since I haven’t gone in-depth with this.

This seems to be a very focused project using that tool and as I said most of the community here might not be able to help you out as it’s not just a python related issue.

Alteryx seems to have its own community/forum based on a quick search and I would recommend posting your issues there.

1 Like

Thanks for responding the_doctor.When there is a file the code works as expected.When there is no file.Instead of going to except block.It throws the error as in screenshot.Is there a way to make it go to except block.(fyi…checked in Altreyx community, they said it could be realted to Python)…thanks