TypeError: object of type 'NoneType' has no len()

I am using the Sen2cor standalone package for converting L1C data into L2A product. But i am getting the error of “TypeError: object of type ‘NoneType’ has no len()”. Please help me. I am stuck there.

I think I know what has happened, but not how or why.

A value in the .config object (L2A_TILE_MTD_XML) has the value None - where it should have been overwritten with the file path used to store the metadata for the granule - a file called MTD_TL.xml

Without more details of your setup I can’t see why this happened.

One workround to try - if the sen2cor program has crashed before, it may have left a partially complete output directory. Look for a directory named S2?_MSIL2A_XX.SAFE, where XX is the long date and orbit string and ? is either A or B. The XX part will appear in the input filename you are trying to process. Try deleting this directory - be careful not to get the _MSIL1C_ directory that contains your input data!

1 Like

I am using windows operating system. And Sen2cor standalone is installed on the system. Snap 6.0.0 is used for the processing of sentinel-2 imagery.

Hi g8sqh,
I can see you have solved this problem before. I am getting the same problem again and can’t solve even after following your instructions. I am using v 11 of Sen2Cor in SNAP 9 for Sentinel-2 images from 2018. Do you have any idea why this is happening? I tried correcting images using command line also but got the same problem.
Could you please help me?
Thank you.

Hello,
I still have the same error and I followed the previous instructions. I can’t solve the problem knowing that I am using the same version and the same software. Did you manage it? I’ll be thankful if there anyone can help.

1 Like

Hi all, I have the same error. I am running SNAP v.9.0.0 and Sent2 toolbox 9.0.2 on a Win10 PC.

Please advise solution.

Regards Grant

We have a similar issue that hasn’t been resolved. Any thoughts?

Traceback (most recent call last):
File “C:\Users\srgreb.snap\auxdata\Sen2Cor-02.11.00-win64\Lib\site-packages\sen2cor\L2A_Process.py”, line 734, in
sys.exit(main())
File “C:\Users\srgreb.snap\auxdata\Sen2Cor-02.11.00-win64\Lib\site-packages\sen2cor\L2A_Process.py”, line 500, in main
datastrip_generated = os.path.exists(os.path.join(config.output_dir,‘temp’,‘DATASTRIP’))
File “C:\Users\srgreb.snap\auxdata\Sen2Cor-02.11.00-win64\lib\ntpath.py”, line 65, in join
result_drive, result_path = splitdrive(path)
File “C:\Users\srgreb.snap\auxdata\Sen2Cor-02.11.00-win64\lib\ntpath.py”, line 115, in splitdrive
if len(p) > 1:
TypeError: object of type ‘NoneType’ has no len()
Finished tool execution in 8 seconds