Problem with source_python using pulp in Windows



I have a script that runs perfectly in python from the command line or using shell in R, but not when trying to use source_python or py_run_file in R.

The scripts reads a csv file, uses pulp to do some optimization and writes the result as a csv file.

Session Info

R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

I think the problem is with pulp or Windows, I get the following error:

Error in py_run_file_impl(file, local, convert) :
OSError: [WinError 6] Controlador no válido

Detailed traceback:

File "", line 87, in 
File "C:\PROGRA3\ANACON1\lib\site-packages\pulp\", line 1664, in solve
status = solver.actualSolve(self, **kwargs)
File "C:\PROGRA3\ANACON1\lib\site-packages\pulp\", line 1362, in actualSolve
return self.solve_CBC(lp, **kwargs)
File "C:\PROGRA3\ANACON1\lib\site-packages\pulp\", line 1420, in solve_CBC
stderr = pipe)
File "C:\PROGRA3\ANACON1\lib\", line 667, in init
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
File "C:\PROGRA3\ANACON1\lib\", line 890, in _get_handles
p2cread = _winapi.GetStdHandle(_winapi.STD_INPUT_HANDLE)


Hi! Welcome to RStudio Community!

It looks like your code was not formatted correctly to make it easy to read for people trying to help you. Formatting code allows for people to more easily identify where issues may be occuring, and makes it easier to read, in general. I have edited you post to format the code properly.

In the future please put code that is inline (such as a function name, like mutate or filter) inside of backticks (`mutate`) and chunks of code (including error messages and code copied from the console) can be put between sets of three backticks:

example <- foo %>%
  filter(a == 1)

This process can be done automatically by highlighting your code, either inline or in a chunk, and clicking the </> button on the toolbar of the reply window!

This will help keep our community tidy and help you get the help you are looking for!

For more information, please take a look at the community's FAQ on formating code