3

I am using Neo4j 3.4.7 and this is simple query i tried to run:

 CALL apoc.load.csv('test.csv') yield lineNo, map , list
 RETURN *;

after getting error I set following apoc related rules in conf file:

 apoc.import.file.enabled=true
 apoc.import.file.use_neo4j_config=true
 dbms.security.allow_csv_import_from_file_urls=true

but still i get above error, any help or hint?

shafigh
  • 61
  • 1
  • 2
  • 10

2 Answers2

2

I was just working on the same apoc.load.csv procedure in the Neo4j 3.4.7 desktop environment. I received the exact same error. I was using the same config rules that @shafig posted. I changed the file source in the config to enable the absolute file path. apoc.import.file.use_neo4j_config=false

After I reran the procedure with the full path, it executed correctly. It appears that using the import directory does not work correctly.
Brett

1

This error is caused by one of 3 conditions

  • The given file does not exist
  • The given file is not a file (like a directory)
  • The program does not have permission to read the file (OS constraint)

I'm guessing the first one is probably the problem. I recommend you use the absolute file path so that execution context doesn't matter. (It is probably looking in the directory that the neo4j start files are or the apoc jar location, or god knows where really when OS behavior is involved.) If you use the absolute path though, it won't matter what the "current directory" from APOC's view is. (Just in case, I will also mention that the file you are reading must actually be on the same computer as Neo4j)

If that isn't it, than either another program has a write lock on the file (close any programs that have the file open to release any locks they may have placed), or read restrictions are placed on the file (Contact your system administrator to fix file permission issues. I highly doubt user read permissions is the problem, but is possible)

Tezra
  • 8,463
  • 3
  • 31
  • 68
  • when the file is in import folder, it must find it. I shorted the error, the part that give the address of its search, which was exactly the place, where the my csv file settles. – shafigh Sep 15 '18 at 00:38
  • @shafigh The 3 conditions I listed are the only things that can throw the error you listed. It's in the [source code](https://github.com/neo4j-contrib/neo4j-apoc-procedures/search?q=%22Cannot+open+file%22&unscoped_q=%22Cannot+open+file%22). Have you tried using the absolute file path? – Tezra Sep 17 '18 at 12:19