Skip to content

BUG: utils.testing.get_locales() #9744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
davidastephens opened this issue Mar 28, 2015 · 6 comments · Fixed by #9839 or #9845
Closed

BUG: utils.testing.get_locales() #9744

davidastephens opened this issue Mar 28, 2015 · 6 comments · Fixed by #9839 or #9845
Labels
Compat pandas objects compatability with Numpy or Python functions
Milestone

Comments

@davidastephens
Copy link
Contributor

Line 334: raw_locales = [] deletes the data received from locale_getter, so the return from this function is always a blank list.

  try:
        raw_locales = locale_getter()
    except:
        return None

    try:
        # raw_locales is "\n" seperated list of locales
        # it may contain non-decodable parts, so split
        # extract what we can and then rejoin.
        raw_locales = []
        for x in raw_locales:
            try:
                raw_locales.append(str(x, encoding=pd.options.display.encoding))
            except:
                pass
    except TypeError:
        pass

    if prefix is None:
        return _valid_locales(raw_locales, normalize)

    found = re.compile('%s.*' % prefix).findall('\n'.join(raw_locales))
    return _valid_locales(found, normalize)

https://github.com/pydata/pandas/blob/8d2818e32d0bbb50e183ccb5724c391e4f604670/pandas/util/testing.py#L334

@jreback
Copy link
Contributor

jreback commented Mar 28, 2015

it DOES run, but you have to override the locale; see the .travis.yml which sets the env variable which travis interprets.

@jreback
Copy link
Contributor

jreback commented Mar 28, 2015

see the install section: https://travis-ci.org/pydata/pandas/jobs/55924400

@jreback
Copy link
Contributor

jreback commented Mar 28, 2015

hmm, looking at the code it does seem that it is overriden...

@davidastephens
Copy link
Contributor Author

I tried that in a test branch. The problem is the code in pandas.utils.get_locales().

You get the locales:
raw_locales = locale_getter()
Next line that runs is:
raw_locales = []

So the function never returns any locales.

I made the fix in:
davidastephens@4b1e35d

And the Travis test has a bunch of errors in TestGoogle (because it wasn't running before).
https://travis-ci.org/dstephens99/pandas/jobs/56178961

@davidastephens
Copy link
Contributor Author

I'm fixing up the data-readers code, when I finish I'll make a pull request to update the pandas data / test_data code, then a pull request to fix this bug.

@jreback
Copy link
Contributor

jreback commented Mar 28, 2015

@dstephens99 ok, gr8!

@jreback jreback added the Compat pandas objects compatability with Numpy or Python functions label Mar 28, 2015
@jreback jreback added this to the 0.16.1 milestone Mar 28, 2015
@ginggs ginggs mentioned this issue Aug 14, 2018
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
2 participants