Pyspark command can't be parsed

Hello everyone,

I’ve been having an issue with the analysis of a pyspark file:

  • Azure Devops used
  • Scanner used: sonar-scanner cli
  • Languages of the repository: python (since pyspark is treated as python)

this is the error that I have:

2026-10-30T09:38:17.9237841Z 10:38:13.883 INFO  19 source files to be analyzed
2026-10-30T09:38:17.9257597Z ##[error]10:38:16.508 ERROR Unable to parse file: Fabric/workspace/RawToBronze.Notebook/notebook-content.py
2026-10-30T09:38:17.9263838Z 10:38:16.508 ERROR Unable to parse file: Fabric/workspace/RawToBronze.Notebook/notebook-content.py
2026-10-30T09:38:17.9266393Z ##[error]10:38:16.510 ERROR Parse error at line 65 column 0:

   44: load_id = "2206100"
   45: keyvault_name = ""
   46: src_system = "SAP_ERP"
   47: src_name = ""
   48: bronze_load_mode = None
   49: 
   50: 
   51: 
   52: 
   53: 
   54: 
   55: 
   56: 
   57: 
   58: 
   59: 
   60: 
   61: 
   62: 
   63: 
   64: 
  -->  %run SDE_NB_000_Utils
   66: 
   67: 
   68: 
   69: 
   70: 
   71: 
   72: 
   73: 
   74: 
   75: 
   76: olu = OneLakeUtils()
   77: 
   78: 
   79: 
   80: 
   81: 
   82: 
   83: 
   84: 
   85: 
   86: 
   87: 
   88: 
   89: 
   90: 
   91: du = DeltaUtils(spark, keyvault_name, src_system, src_name)
   92: raw_data_root_dir = du.get_raw_data_root_dir()
2026-10-30T09:38:17.9267857Z 10:38:16.510 ERROR Parse error at line 65 column 0:

Hey @Giuseppe_Rizza, is this actually a pure python file? Or does it contain notebook syntax? I see the %run command, which is typical of notebooks but is not real python syntax. I suspect the process by which you are exporting the notebook into a .py file isn’t producing a 100% valid python file.

Yes, I confirm it’s a notebook.py file

Okay, I see. In principle, we should be able to analyze notebook files. However, I’m not sure we expect them to have a .py file extension. I’m going to flag this for the team to verify.

Hello @Giuseppe_Rizza.

right now we don’t yet support Notebook in normal .py files. We have a ticket to detect those usages. At this moment, the workaround would be to provide the notebook in Jupyter .ipynb format. Fabric supports exporting notebooks in that format.

Cheers,
Victor

thank you so much for the support!