Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory error #131

Open
vishaln79 opened this issue Jul 26, 2018 · 3 comments
Open

No such file or directory error #131

vishaln79 opened this issue Jul 26, 2018 · 3 comments
Labels

Comments

@vishaln79
Copy link

I am trying to run a python script within node:
var options = {

    scriptPath: '/var/upload/file-importer',
    args: ["-f '"+files+"'", "-d " + destination, "-p " + path, "-u " + username, "-c  /var/upload/file-importer/config.json", "-e " + environment]

}

PythonShell.run('file-importer-lite.py', options, function (err) {

I am getting a:
{ Error: IOError: [Errno 2] No such file or directory: ' /var/upload/file-importer/config.json'
at PythonShell.parseError (/var/upload/bridges/nodejs/node_modules/python-shell/index.js:184:17)
at terminateIfNeeded (/var/upload/bridges/nodejs/node_modules/python-shell/index.js:98:28)
at ChildProcess. (/var/upload/bridges/nodejs/node_modules/python-shell/index.js:89:9)
at ChildProcess.emit (events.js:182:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)

----- Python Traceback -----
File "/var/upload/file-importer/file-importer-lite.py", line 269, in <module>
  main()
File "/var/upload/file-importer/file-importer-lite.py", line 251, in main
  with open(config_path) as conf_file:

traceback:
'Traceback (most recent call last):\n File "/var/upload/file-importer/file-importer-lite.py", line 269, in \n main()\n File "/var/upload/file-importer/file-importer-lite.py", line 251, in main\n with open(config_path) as conf_file:\nIOError: [Errno 2] No such file or directory: ' /var/upload/file-importer/config.json'\n',
executable: 'python',
options: null,
script: '/var/upload/file-importer/file-importer-lite.py',
args:
[ '-f '/var/upload/xxx.zip'',
'-d xxx',
'-p /xxxx/xxx',
'-u xxx',
'-c /var/upload/file-importer/config.json',
'-e dev' ],
exitCode: 1 }

error even though the file exists. What am I doing wrong? I even tried giving a relative path to this file, but to no avail.

Any suggestions?
Thanks,
Vishal.

@vishaln79 vishaln79 changed the title No such file or directory No such file or directory error Jul 26, 2018
@alienbuild
Copy link

I have a similar problem and I believe what it may be doing is looking in this path due to the script path, but I'm unsure.
/var/upload/file-importer/var/upload/file-importer/config.json

If you found a resolution do please share. Thanks

@McToluene
Copy link

Having same issue

@telion2
Copy link

telion2 commented Aug 6, 2019

Im not a collaborator, but I think you paths are wrong as they are neither absolute nor relative.
Absolute paths would be something like this: 'C:/user/username/.../folderx/filex.py'
and relative Paths use this Notation: './folderx/filex.py'
./ = same Directory, ../ = one Directory up ../../ = 2 Directorys up.
You also can use the npm module 'path' and use path.resolve('yourPath');
At the end the full absolute Path should be printed by python shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants