Skip to content
This repository has been archived by the owner on Apr 20, 2020. It is now read-only.

system(batch_cmd.cmd) with error #26

Closed
eivindhammers opened this issue Jan 6, 2017 · 3 comments
Closed

system(batch_cmd.cmd) with error #26

eivindhammers opened this issue Jan 6, 2017 · 3 comments

Comments

@eivindhammers
Copy link
Contributor

I get an error trying to retrieve parameters from QGIS. I run get_args_man("grass:v.clean") and get

C:\Users\eivinol\AppData\Local\Temp\RtmpwzBJdD
python: can't open file 'py_cmd.py': [Errno 2] No such file or directory
[1] 2
Warning message:
running command 'batch_cmd.cmd' had status 2

Now there may be something wrong with my installation, but I can't figure out what that would be.

It seems that calling o4w_env.bat changes the working directory to %OSGEO4W_ROOT%, and there is nothing that changes it back to the R temp directory before python py_cmd.py is called. I fixed this in my fork with a "set wd=%~dp0" before calling o4w_env.bat, and "pushd %wd%" after.

Replacing system("batch_cmd.cmd", intern = intern) with shell("batch_cmd.cmd") in `execute_cmds()' also works. Manually running the batch_cmd.cmd from cmd.exe also works.

@pat-s
Copy link
Member

pat-s commented Jan 6, 2017

  1. Do you have the Kyngchaos QGIS version installed or did you use the OSGEO4W installer?
  2. Windows 7/8/10?

There is no need to change anything manually from RQGIS core as we are taking care that everything is working :-)

@eivindhammers
Copy link
Contributor Author

I always forget the environment variables: All OSGEO on Windows 7.

@jannes-m
Copy link
Collaborator

jannes-m commented Jan 7, 2017

Hey there,

I just installed the latest QGIS version on my Windows machine. The good news is, that the QGIS core team finally took care of the annoying Processing issue (see https://github.com/jannes-m/RQGIS#qgis-216-modifications). The bad news is that they again changed the source code in such a way that it breaks RQGIS as pointed out by eivindhammers. I adopted eivindhammers solution to the problem though it reminds me that we should rewrite execute_cmds so that it can also be used with qgis_session_info, open_help and get_args_man. This would delete rendundany and make the code more consistent. In this case, we could have had rewritten the python py_cmd.py to paste("python", file.path(tmp_dir), "py_cmd.py")) in execute_cmds.

Anyways, thank you, eivindhammers, for pointing out and solving this issue!! As a consequence, we need to quickly update RQGIS on CRAN!

@pat-s pat-s added the bug label Jan 7, 2017
pat-s referenced this issue Jan 7, 2017
otherwise, RQGIS breaks beginning with QGIS 2.18.2
@jannes-m jannes-m closed this as completed Jan 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants