I am trying to use a module located in the same directory as the script I am running and I get the following error:
TypeError: 'module' object is not callable
This was working before, but I did some modifications to the sys.path list since I wanted to call modules from other directories, and from that point it stopped working.
This is my folder's structure:
Neural_Network/
split_data.py
test.ipynb
I get the error executing test.ipynb:
import split_data
import os
print(split_data.__file__)
trainset, testset, valset = split_data.split_data_func(os.path('data'))
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4936/633432209.py in <module>
4
5 print(split_data.__file__)
----> 6 trainset, testset, valset = split_data.split_data_func(os.path('data'))
7
8 """"
TypeError: 'module' object is not callable
print(split_data.__file__)
is giving the right path to the module.
The module split_data.py has a single function:
import math
import os
import random
def split_data_func(path):
...
return trainset, testset, valset
This was working before and I don't know what could have happened.
In the sys.path I have the path to Neural_Network/ directory.
UPDATE
I was looking the error regarding the split_data module and the error was with the os module, I just changed to:
trainset, testset, valset = split_data.split_data_func(os.path.join(os.getcwd(),'dataset_days'))