When running the script when run via Pycharm or in local terminal using pdb, the script works perfectly. When run in the terminal, however, whether it's the local interpreter or Pycharm's emulated terminal, one of the lines fails out. The issue here is, as stated above, when I run the script through pdb in my local terminal (WITHOUT being inside the project env), it works as expected. All variables end up as they do in Pycharm, so I don't know where exactly the problem is occurring.
The file being executed is a symlink to the original project file. The error is occuring somewhere in here:
def find_image_link(self):
try:
request = urlopen(self.src_url)
except HTTPError as e:
print("HTTP Error:", e)
except URLError as e:
print("Page not found:", e)
except ConnectionError as e:
print("Connection error:", e)
else:
try:
html = request.read().decode("utf-8")
soup = BeautifulSoup(html, "html.parser")
div = soup.find("link", {"rel": "image_src"})
link = div.get("href")
except AttributeError as e:
print("Could not find necessary attribute:", e)
else:
self.img_url = link```