I have this :
poly1 = ogr.CreateGeometryFromWkt(polygons)
and error :
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "C:\PROGRA~1\QGIS3~1.6\apps\Python37\lib\site-packages\osgeo\ogr.py", line 5666, in CreateGeometryFromWkt
return _ogr.CreateGeometryFromWkt(*args, **kwargs)
TypeError: not a string
OG.CreateGeometryFromWkt (name_layer)
and you have some WKT looking image (code is better) as a result. If your input was a shapefile then something has obviously worked. So what were you expecting? You also say you want to do an intersection on two shapefile layers, but that doesn't seem relevant to your code.