NameError: name '_name_' is not defined
e12kut opened this issue · 2 comments
Hi,
I want to download the footprints of Turkey. I used this code below as given in the tutorials:
"import pandas as pd
import geopandas as gpd
from shapely.geometry import shape
def main():
# this is the name of the geography you want to retrieve. update to meet your needs
location = 'Turkey'
dataset_links = pd.read_csv("https://minedbuildings.blob.core.windows.net/global-buildings/dataset-links.csv")
turkey_links = dataset_links[dataset_links.Location == location]
for _, row in turkey_links.iterrows():
df = pd.read_json(row.Url, lines=True)
df['geometry'] = df['geometry'].apply(shape)
gdf = gpd.GeoDataFrame(df, crs=4326)
gdf.to_file(f"{row.QuadKey}.geojson", driver="GeoJSON")
if name == "main":
main() "
but I get this error: "NameError Traceback (most recent call last)
/var/folders/kl/qlgjhkh97pv05b914qyhpjmm0000gn/T/ipykernel_1180/2519136811.py in
16
17
---> 18 if name == "main":
19 main()
NameError: name 'name' is not defined"
Could you please help me?
Did you clone or copy the raw script? __name__
is a special python variable. From the error, it also looks like the double underscores are missing rom __main__
.
If the raw script doesn't fix the issue, feel free to reopen.