Skip to main content
Question

Hi, i want to read a compressed file within a python caller. It works fine, as long as i reference to a *.gz file located in the file system of my pc.


femo
Contributor
Forum|alt.badge.img+6
  • Contributor

 However, I would like to directly read the same file from a URL.

Therefore, i have changed the published parameter accordingly (see screenshot attached). The following error messages is produced:

Emptying factory pipeline

https://www.opengeodata.nrw.de/produkte/geobasis/hm/dgm1_xyz/dgm1_xyz/dgm1_32_372_5714_1_nw.xyz.gz

Python Exception <FileNotFoundError>: [Errno 2] No such file or directory: 'https://www.opengeodata.nrw.de/produkte/geobasis/hm/dgm1_xyz/dgm1_xyz/dgm1_32_372_5714_1_nw.xyz.gz'

Traceback (most recent call last):

 File "<string>", line 24, in input

 File "gzip.py", line 58, in open

 File "gzip.py", line 174, in __init__

FileNotFoundError: [Errno 2] No such file or directory: 'https://www.opengeodata.nrw.de/produkte/geobasis/hm/dgm1_xyz/dgm1_xyz/dgm1_32_372_5714_1_nw.xyz.gz'

Error encountered while calling method `input'

PythonCaller_3 (PythonFactory): PythonFactory failed to process feature

An error has occurred. Check the logfile above for details

Translation FAILED with 4 error(s) and 1 warning(s) (0 feature(s) output)

FME Session Duration: 1.7 seconds. (CPU: 0.1s user, 0.3s system)

END - ProcessID: 16596, peak process memory usage: 99848 kB, current process memory usage: 99320 kB

An error has occurred. Check the logfile above for details

Program Terminating

Translation FAILED.

 

Any ideas what I do wrong?

 

 

2 replies

virtualcitymatt
Celebrity
Forum|alt.badge.img+36

You'll need to first download the file in your python caller. You can either write some python code to do that or you can use an HTTPCaller in FME to first download the files to somewhere on your system. If you don'T want to keep the file you can use a TempPathNameCreator which will give you a path name where you download your file to- the path will get deleted at the end of the workspace

 


femo
Contributor
Forum|alt.badge.img+6
  • Author
  • Contributor
  • March 31, 2023

Thanks a lot. I've choosen the http-caller approach, it works fine. I first thought that directly reading from the web source would be smarter. However, temporarily keeping the data in the file system is also ok.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings