tchivs opened a new issue, #35617:
URL: https://github.com/apache/beam/issues/35617

   ### 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
   ```python
   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:
   1. Install a Unix-like environment (WSL, Git Bash, etc.)
   2. Create a custom `which.bat` script
   3. 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
   
   - [x] Component: Python SDK
   - [ ] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [ ] Component: IO connector
   - [x] Component: Beam YAML
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Infrastructure
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Samza Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [ ] Component: Google Cloud Dataflow Runner


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to