Skip to content

Conversation

@rohandhar6824-debug
Copy link
Contributor

Updated BrainFlow EEG files:

  • emulator/: cyton_windows.py, freeeeg32_windows.py, knightboard_windows.py

  • python_package/brainflow/: board_shim.py, data_filter.py, ml_model.py

Eliminates pkg_resources deprecation warnings

Updated BrainFlow EEG files:

- emulator/: cyton_windows.py, freeeeg32_windows.py, knightboard_windows.py

- python_package/brainflow/: board_shim.py, data_filter.py, ml_model.py

✅ Eliminates pkg_resources deprecation warnings
Comment on lines 24 to 26
except (TypeError, AttributeError):
import pkg_resources
return pkg_resources.resource_filename(__name__, os.path.join('com0com', 'setup_com0com_W7_x64_signed.exe'))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are these except blocks trying to accomplish? Are they for backwards compatibility with older versions of python? If so, I'd suggest adding a comment to indicate that they exist for that reason, and I'd like to note that importlib has existed in python since 3.1. If not, you should definitely add a comment explaining why. Regardless, it's probably also worth emitting a warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pandapip1 Thank you for the detailed review and suggestion.
Yes, exactly- except (TypeError, AttributeError) blocks provide backward compatibility.
The TypeError catches cases where importlib.resources.files() returns something unexpected, and AttributeError catches when the method doesn't exist (Python < 3.9).
While importlib.resources has existed since Python 3.1, the files() API wasn't introduced until Python 3.9. This is the modern, recommended way to access package resources.

I have added comment.

@Andrey1994
Copy link
Member

Looks good to me, thanks

@Andrey1994 Andrey1994 merged commit 5ebe075 into brainflow-dev:master Jan 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants