Alteryx Designer Desktop Discussions

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

Python Tool gives error FileNotFoundError for filenames starting with 00

gorkemakinci
6 - Meteoroid

Hi there I have thousands of xml files and I read them through a python tool (incase there are zips in there, in that case the code unzips xml's and reads them too), but I'm receiving error on just a couple of files and the only difference of theirs is that their filenames are starting with double zeros (e.g. 00abc...-xyz-...-kml.xml)

 

I receive the following error (changed the path and filename for confidentiality reasons but the structure is the same);

 

FileNotFoundError Traceback (most recent call last)
<ipython-input-6-6c05d55cfa3b> in <module>
2 files = []
3 for file in file_list:
----> 4 with open(file, "r", encoding="utf-8") as f:
5 xml = f.read()
6 if xml not in xmls:
FileNotFoundError: [Errno 2] No such file or directory: '\\\\ABC123\\main folder\\2023\\A\\AAA folder\\All files\\xml and zips\\xml files\\some spesific folder\\last spesific folder\\00123-8htM-Snee-f8PC-uYnTsMg3.xml'

 

Is there any idea what is the reason behind this error and how can I avoid it since I also need the exact filename that I use in the output of this workflow? Lots of thanks in advance, have a nice day everyone!

4 REPLIES 4
danilang
19 - Altair
19 - Altair

Hi @gorkemakinci 

 

Have you tried to open the missing files using a text editor?

 

Dan

gorkemakinci
6 - Meteoroid

Hey @danilang thanks for replying to the topic.

 

I actually found out that python tool was giving me this error because the full path length was over 256 chars. When I run the same .xml files through my workflow with a shortened folder names it works like a charm.

 

Is there any way to give permission to Python tool or Alteryx (don't actually know which part is the problematic one right now) work like until 512 chars length of a full path?

danilang
19 - Altair
19 - Altair

Hi @gorkemakinci 

 

Check section 4.1.2. Removing the MAX_PATH Limitation the in https://docs.python.org/3/using/windows.html.  If your workflow is destined for Alteryx Server, your server admin will have to apply the same fix

 

Dan

gorkemakinci
6 - Meteoroid

Hi again @danilang !

Thanks a lot for the document and the article that'll most probably be my solution. I'll be able to try it on Monday and will keep here updated, the first question of mine was totally different but I was able to identify the real problem behind everything a bit later on so I still hope this topic will help people who might have the same problem. Thanks again, have a nice night!

Labels