What happened?
/take-issue
Bug Description
The JavaJarProvider.available() method in apache_beam/yaml/yaml_provider.py uses the Unix-specific which command to check for Java availability, which causes a FileNotFoundError on Windows systems.
Environment
- OS: Windows 10/11
- Python version: 3.12.10
- Apache Beam version: Latest (from main branch)
- Error location:
apache_beam/yaml/yaml_provider.py:388
Error Details
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
File "apache_beam\yaml\yaml_provider.py", line 388, in available
trial = subprocess.run(['which', 'java'], capture_output=True)
Root Cause
The which command is Unix/Linux specific and doesn't exist on Windows. Windows uses the where command for similar functionality.
Current Code
def available(self):
# pylint: disable=subprocess-run-check
trial = subprocess.run(['which', 'java'], capture_output=True)
if trial.returncode == 0:
return True
else:
# ... error handling
Expected Behavior
The YAML provider should work correctly on all supported platforms including Windows.
Proposed Solution
Use platform-specific commands:
- Windows:
where java
- Unix/Linux:
which java
- Fallback:
shutil.which('java') for cross-platform compatibility
Impact
This affects all Windows users trying to use Apache Beam's YAML functionality, preventing them from using this feature entirely.
Workaround
Currently, users need to either:
- Install a Unix-like environment (WSL, Git Bash, etc.)
- Create a custom
which.bat script
- Apply manual patches to the source code
Additional Context
This is a cross-platform compatibility issue that should be straightforward to fix with platform detection.
Labels
/add-labels bug,P2,windows,yaml,cross-platform
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
What happened?
/take-issue
Bug Description
The
JavaJarProvider.available()method inapache_beam/yaml/yaml_provider.pyuses the Unix-specificwhichcommand to check for Java availability, which causes aFileNotFoundErroron Windows systems.Environment
apache_beam/yaml/yaml_provider.py:388Error Details
Root Cause
The
whichcommand is Unix/Linux specific and doesn't exist on Windows. Windows uses thewherecommand for similar functionality.Current Code
Expected Behavior
The YAML provider should work correctly on all supported platforms including Windows.
Proposed Solution
Use platform-specific commands:
where javawhich javashutil.which('java')for cross-platform compatibilityImpact
This affects all Windows users trying to use Apache Beam's YAML functionality, preventing them from using this feature entirely.
Workaround
Currently, users need to either:
which.batscriptAdditional Context
This is a cross-platform compatibility issue that should be straightforward to fix with platform detection.
Labels
/add-labels bug,P2,windows,yaml,cross-platform
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components