Hi All I am trying to do map plotting using python and I am using a shapefile of the UK ITL3 regions obtained from the ONS geo portal and I want to build it in python however the issue I am getting is that an exception error which I will attach now:
Traceback (most recent call last):
File "C:\Users\\PycharmProjects\pythonProject3\Map2.py", line 15, in <module>
sf = shp.Reader(shp_path)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\shapefile.py", line 1048, in __init__
self.load(path)
File "C:\Users\AppData\Roaming\Python\Python39\site-packages\shapefile.py", line 1193, in load
raise ShapefileException("Unable to open %s.dbf or %s.shp." % (shapeName, shapeName))
shapefile.ShapefileException: Unable to open \ITL3_JAN_2021_UK_BFE_V3.dbf or \ITL3_JAN_2021_UK_BFE_V3.shp.
The code I am using is this one:
import numpy as np
import pandas as pd
import shapefile as shp
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style="whitegrid", palette="pastel", color_codes=True)
sns.mpl.rc("figure", figsize=(10,6))
#opening vector map
shp_path ="\\ITL3_JAN_2021_UK_BFE_V3.shp"
sf = shp.Reader(shp_path)
len(sf.shapes())
Any help to try and resolve this would be much appreciated so I can view the records that are contained in the shapefile.

I see you did not specify the right path for your file, The error is indicating that Unable to open \ITL3_JAN_2021_UK_BFE_V3.dbf or \ITL3_JAN_2021_UK_BFE_V3.shp.
try to save the file in this path for example
path = "C:\myfolder\ITL3_JAN_2021_UK_BFE_V3.shp"
or try this
path = r"C:\myfolder\path_to_your_file\ITL3_JAN_2021_UK_BFE_V3.shp"
Make sure you can access the path to your file location by pasting it in your windows browser. adjust your code accordingly.
Hope this helps.