Skip to content

Fix issue #190: Check Python version and locale encoding at startup - #444

Merged
aaronchantrill merged 3 commits into
NaomiProject:naomi-devfrom
Sekhar03:naomi-dev
Aug 31, 2026
Merged

aaronchantrill merged 3 commits into
NaomiProject:naomi-devfrom
Sekhar03:naomi-dev

Conversation

@Sekhar03

Copy link
Copy Markdown
Contributor

This pull request moves the Python version check to the top of Naomi.py and Populate.py (before naomi is imported) and adds a system locale check to warn the user if a non-UTF-8 locale is detected.

Comment thread Naomi.py Fixed
Comment thread Populate.py Fixed
@CLAassistant

CLAassistant commented Aug 13, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Sekhar03

Copy link
Copy Markdown
Contributor Author

CLA Accepted

@aaronchantrill

Copy link
Copy Markdown
Contributor

Hello Sekhar, thank you for submitting to Naomi. I am reviewing your modifications now. I should have a comprehensive review sometime this weekend.

-Aaron

Comment thread naomi/llama_client.py Fixed
Comment thread naomi/llama_client.py Fixed
Comment thread naomi/llama_client.py Fixed
Comment thread naomi/llama_client.py Fixed
Comment thread naomi/llama_client.py Fixed
Comment thread naomi/llama_client.py Fixed
Comment thread naomi/mic_asynchronous.py Fixed
@aaronchantrill
aaronchantrill self-requested a review August 18, 2026 21:57
@aaronchantrill aaronchantrill self-assigned this Aug 18, 2026
@aaronchantrill

Copy link
Copy Markdown
Contributor

Please bear with me while I review all these changes. It's a lot to get through.

The first thing that I see is that you appear to be on the LLM branch, but are pushing to the naomi-dev branch, thus pulling in a bunch of experimental code. It would be easier to just merge this into the LLM branch.

Thanks,
Aaron

@Sekhar03
Sekhar03 changed the base branch from naomi-dev to LLM August 20, 2026 05:12
@Sekhar03

Copy link
Copy Markdown
Contributor Author

Hello Aaron, I have changed the base branch of this PR to the \LLM\ branch as suggested. This separates the experimental LLM changes from
aomi-dev. Thanks!

@Sekhar03
Sekhar03 changed the base branch from LLM to naomi-dev August 20, 2026 05:15
@Sekhar03

Copy link
Copy Markdown
Contributor Author

Hello Aaron, I have cleaned up this branch so that it now contains ONLY the single commit for fixing issue #190 (checking the Python version and locale encoding at startup). I have targeted it back to
aomi-dev. The experimental LLM changes and other bug fixes have been removed from this branch/PR. Thanks!

@aaronchantrill

Copy link
Copy Markdown
Contributor

Hey, thank you. I really appreciate it. What are you interested in working on with this project?

@Sekhar03

Copy link
Copy Markdown
Contributor Author

Hello Aaron, I've just pushed a fix to address the CodeQL empty except warnings on the startup locale check.

As for what I'm interested in working on, I'd love to help with the LLM integrations, specifically improving the Llama client and database conversation logging (and making them work smoothly with platforms like SillyTavern/Naomi). Let me know if that sounds good or if there is anything else you'd like me to look at!

@aaronchantrill

Copy link
Copy Markdown
Contributor

That is great! You can see that the llm code in Naomi is primitive. I'm about to publish a new version with a few improvements such as pulling the template directly from /props instead of having to specify one. I'll let you know when I put it up. Personally, I'm particularly interested in speaker recognition and accessibility.

I did write a little bit of code a couple of weeks ago that allowed me to extract the json data from a .png character card if you'd like to play with implementing character cards. I think being able to import and export conversations and personalities with SillyTavern would be very helpful. Do you have any thoughts about replacing speechhandlers with mcp servers?

@aaronchantrill

Copy link
Copy Markdown
Contributor

By the way, part of what's taking me so long right now is dusting off an old Raspberry Pi to test on. It's still a good test environment for us because it's pretty standard and easy to refresh. I have run an LLM directly off of a 4G Pi5. I've lost my microhdmi->hdmi adapter and for some reason my Pi5 isn't coming up. I should be able to test with a Pi3, and of course I could just start a new virtual machine in VMM. I have read your code and for the most part I understand what it's doing.

@aaronchantrill aaronchantrill left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a simple check for character encoding. Using anything other than a utf-8 encoded character set is likely to cause issues. This check does not prevent the program from running if the character set is wrong, but does provide a warning that could be useful to the end user.

The only change I would request would be to gather all the "import" statements at the top of each module, as is normal within this project, rather than importing them as they are used.

Either way, I'm happy to approve this pull request.

@aaronchantrill

aaronchantrill commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

So, I finally got an old Raspberry Pi 3B up and running with a brand-new Raspbian Trixie OS, git cloned Naomi (git clone https://github.com/NaomiProject/Naomi), git fetched the pull request (git fetch origin pull/444/head:Sekhar03_naomi-dev). The installer ran normally, which is to be expected since it's written in bash. Once Naomi actually started, there was an error as the audioop library was removed from the standard libraries in Python 3.13. The solution is to pip install audioop-lts and then conditionally import one or the other:

try:
import audioop
except ModuleNotFoundError:
import audioop_lts as audioop

Now this leaves the issue of the requirements.txt file. The audioop-lts library can be made conditional by adding the line:

audioop-lts; python_version >= "3.13"

The same thing appears to have happened with flite, where the pipes library has been removed from the standard libraries, but the pipes.quote() function here can be replaced with a shlex.quote().

@aaronchantrill
aaronchantrill merged commit 5a5f3ce into NaomiProject:naomi-dev Aug 31, 2026
3 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.

4 participants