I'm currently working on a project and I keep getting this error when executing a Python script:
File "D:\projects\company\spiders\country\spain\cities\runnables\short.py", line 22, in <module>
soup = get_soup_from_url(url, "html.parser")
NameError: name 'get_soup_from_url' is not defined
The function "get_soup_from_url" is getting imported from another file that's located on another directory. In order of giving a minimal reproducible example i made this little project where I'm getting the same error with just two basic scripts. Here are the two scripts:
short.py
import sys
sys.path.append('../../../../utils')
from driver import *
print_on_console('Hello world!')
driver.py
def print_on_console(message):
print(message)
So basically I get this error when trying to import the function "print_on_console" into short.py. The project structure follows this:
- spiders
- country
- portugal
- cities
- runnable
- short.py
- utils
- driver.py
I'm sharing this project with other people and they don't have this error with the exact same code, so I guess I missed something when configuring my visual studio code for python but I've been two days searching for what's wrong without finding any solution.
Thanks to anyone who gives me any information in advance.