Skip to content

Terminal redirects fail in Winodws #3277

Open
@effigies

Description

@effigies

select doesn't work on stdout/stderr in Windows. We'll need to move to asyncio, I believe.


Originally posted by @axiezai in #2509 (comment)

I just pointed the dcm2niix example to an empty directory, with the updated installation you suggested:

{'commit_hash': '0dbcedda8',
 'commit_source': 'installation',
 'networkx_version': '2.5',
 'nibabel_version': '3.2.0',
 'nipype_version': '1.6.0-dev',
 'numpy_version': '1.19.4',
 'pkg_path': 'C:\\Users\\Xihe\\anaconda3\\envs\\nipype_test\\lib\\site-packages\\nipype',
 'scipy_version': '1.5.4',
 'sys_executable': 'C:\\Users\\Xihe\\anaconda3\\envs\\nipype_test\\python.exe',
 'sys_platform': 'win32',
 'sys_version': '3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit '
                '(AMD64)]',
 'traits_version': '6.1.1'}

Here's the code I used:

from nipype.interfaces.dcm2nii import Dcm2niix

converter = Dcm2niix()
converter.inputs.source_dir = 'C:/Users/Xihe/Documents/nipype_testing/'
converter.inputs.compression = 5
converter.inputs.output_dir = 'C:/Users/Xihe/Documents/nipype_testing/'
converter.run()

The directory has no dicom images so I expect the following msg:

Error: Unable to find any DICOM images in /mnt/c/Users/Xihe/Downloads (or subfolders 5 deep) 
Return code: 2 

Which is what happens on my ubuntu subsystem on the same windows machine I'm testing on.

But in Windows Anaconda installation I am now getting:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-8-e1d471e9c2ab> in <module>
----> 1 converter.run()

~\anaconda3\envs\nipype_test\lib\site-packages\nipype\interfaces\base\core.py in run(self, cwd, ignore_exception, **inputs)
    432         try:
    433             runtime = self._pre_run_hook(runtime)
--> 434             runtime = self._run_interface(runtime)
    435             runtime = self._post_run_hook(runtime)
    436             outputs = self.aggregate_outputs(runtime)

~\anaconda3\envs\nipype_test\lib\site-packages\nipype\interfaces\dcm2nii.py in _run_interface(self, runtime)
    442     def _run_interface(self, runtime):
    443         # may use return code 1 despite conversion
--> 444         runtime = super(Dcm2niix, self)._run_interface(
    445             runtime, correct_return_codes=(0, 1,)
    446         )

~\anaconda3\envs\nipype_test\lib\site-packages\nipype\interfaces\base\core.py in _run_interface(self, runtime, correct_return_codes)
    825             else "<skipped>"
    826         )
--> 827         runtime = run_command(runtime, output=self.terminal_output)
    828         if runtime.returncode is None or runtime.returncode not in correct_return_codes:
    829             self.raise_exception(runtime)

~\anaconda3\envs\nipype_test\lib\site-packages\nipype\utils\subprocess.py in run_command(runtime, output, timeout)
    135         while proc.returncode is None:
    136             proc.poll()
--> 137             _process()
    138 
    139         _process(drain=1)

~\anaconda3\envs\nipype_test\lib\site-packages\nipype\utils\subprocess.py in _process(drain)
    122         def _process(drain=0):
    123             try:
--> 124                 res = select.select(streams, [], [], timeout)
    125             except select.error as e:
    126                 iflogger.info(e)

OSError: [WinError 10038] An operation was attempted on something that is not a socket

Not sure if this is a separate issue or something weird going on with my old laptop

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions