node2vec icon indicating copy to clipboard operation
node2vec copied to clipboard

IOError: [Errno 2] No such file or directory: 'graph/karate.edgelist'

Open renmi001 opened this issue 5 years ago • 5 comments

problem when running main.py: Traceback (most recent call last): File "D:/node2vec-master/src/main.py", line 104, in main(args) File "D:/node2vec-master/src/main.py", line 96, in main nx_G = read_graph() File "D:/node2vec-master/src/main.py", line 73, in read_graph G = nx.read_edgelist(args.input, nodetype=int, create_using=nx.DiGraph()) File "<D:\Anaconda2\lib\site-packages\decorator.pyc:decorator-gen-170>", line 2, in read_edgelist File "D:\Anaconda2\lib\site-packages\networkx\utils\decorators.py", line 198, in _open_file fobj = _dispatch_dict[ext](path, mode=mode) IOError: [Errno 2] No such file or directory: 'graph/karate.edgelist'

but the file exists,so please help me solve this question,thank you ! image

renmi001 avatar Apr 29 '19 08:04 renmi001

I have the same error with you. Have you solved this problem yet? Could you help me?Thank you very much!

dongcy-AHU avatar May 29 '19 09:05 dongcy-AHU

Maybe it's because the OS route path. Use os.path.join('graph','karate.edgelist') to define the input filename.

raulqf avatar May 29 '19 09:05 raulqf

Maybe it's because the OS route path. Use os.path.join('graph','karate.edgelist') to define the input filename.

I try to import os module and modify the input filename to become os.path.join('graph','karate.edgelist'),but still have the same problem FileNotFoundError: [Errno 2] No such file or directory: 'graph\karate.edgelist'.

dongcy-AHU avatar May 29 '19 10:05 dongcy-AHU

Use the absolute path instead or the relative one to discard problems with the path.

raulqf avatar May 29 '19 11:05 raulqf

If you want relative path just change it like the image below. That happen because the main code runs on 'src' folder and not in root directory. image

Jak32 avatar Feb 21 '21 21:02 Jak32