Rhino.Inside Revit GhPy3 - unknown locale: en-US

Hi,
When running Rhino, Grasshopper inside Revit, we get this error on all python3 components.

  1. unknown locale: en-US

Could you please let me know how to fix it ?
Thank you!

ps. my colleague is working in spanish

hmm, i see a couple possible resolutions, not sure if there is something deeper to fix. I’ll assign this to Ehsan to review when he can.

Option 1: add before any imports..

import locale
locale.setlocale(locale.LC_ALL, 'en_US')

Option 2: to handle any locale

import locale
try:
    locale.setlocale(locale.LC_ALL, '')
except locale.Error:
    locale.setlocale(locale.LC_ALL, 'C')

@Japhy , none of the options seem to work, here’s a screenshot.
Any other suggestions?

Thank you!

Does this work as expected in the rhino environment , can you post us your system info? Rhino version, Revit version are important here.

Hi @Japhy,

At the moment, any python component in grasshopper is throwing this error on my machine. Nothing to do with Revit:

Python 3 in Rhino doesn’t have this issue.

(FWIW, although I’m in the UK my system locale is set to en-US).

Rhino 8.29.26041.10001, 2026-02-10

Regards
Jeremy

@jeremy5 So to be clear, you are using Rhino standalone and not inside Revit right? Does python 3 scripts in Rhino’s main script editor throw the same error or is this just in grasshopper?

Yes, standalone, no Revit. Rhino’s script editor works fine, this issue is just in the Grasshopper one.

@eirannejad,

I just tried this again and it is working correctly! Can’t think of anything that has happened that would change the behaviour. Maybe see if it is working for @Bogdan_Chipara now too?

Regards
Jeremy

Rhino.Inside Revit 1.27.9121.7152 (2024-12-21T03:58:24)
Rhino 8 SR16 8.16.25042.13001, 2025-02-11
We also tried:

import locale
locale.setlocale(locale.LC_ALL, "C")
print("test")

(as ChatGPT suggested, but without any luck)

My colleague will update the software.