Invalid ioLocale

Issue #36 duplicate
Former user created an issue

Hi,

I'm trying to use the SavReader function

import savReaderWriter as spss
savFileName = "my_file.sav"
raw_data = spss.SavReader(savFileName,returnHeader = True, ioUtf8=True)

but I systematically get this error message :

File "C:\Anaconda\lib\site-packages\savReaderWriter\generic.py", line 390, in ioLocale raise ValueError("Invalid ioLocale: %r" % localeName) ValueError: Invalid ioLocale: 'fr_FR.cp1252'

This error persists even if I add a specifical value to ioLocale argument in the SavReader function.

Thanks.

Best regards, Dom

Comments (9)

  1. Albert-Jan Roskam repo owner

    Hi,

    What version of the program are you using? There have been a number of locale-related issues. Better to use the bleeding edge version. I reported a bug in Python about this before (http://bugs.python.org/issue23425), which affects French, among other locales. In the most recent savReaderWriter version this is fixed (I hope!). See the readme on how to pip install the bleeding edge version.

    regards, Albert-Jan

  2. Albert-Jan Roskam repo owner

    PS: what you could also try (in case you cannot easily update savReaderWriter) is to

    reader = spss.SavReader(savFileName, returnHeader=True, ioUtf8=True, ioLocale="french")
    raw_data = reader.all()
    reader.close()
    
  3. Dominique EMMANUEL

    Hi,

    Thank you for your quick answers. I use Python 2.7.9 and the version 3.3.0 of savReaderWriter (it is the bleeding edge, isn't it ?)

    Moreover, If I add

     ioLocale="french"
    

    then it produces a new error :

    File "C:\Anaconda\lib\site-packages\savReaderWriter\error.py", line 118, in checkErrsWarns raise SPSSIOError(msg, retcode) SPSSIOError: Problem getting ReleaseInfo [SPSS_NO_TYPE73]

    Best regards, Dom

  4. Albert-Jan Roskam repo owner

    Hi Dom,

    The bleeding edge version may be installed by using pip install -U -e git+https://bitbucket.org/fomcl/savreaderwriter.git#egg=savreaderwriter, version 3.3.0 is getting quite old by now. Not sure what the type73 error is about. Is this a valid .sav file? If it is a non-confidential file I could have a look.

    Regards, Albert-Jan

  5. Dominique EMMANUEL

    My problem is I can't use this instruction

    #!
    pip install -U -e git+https://bitbucket.org/fomcl/savreaderwriter.git#egg=savreaderwriter
    

    because it produces this error

    #!
    efrror: RPC failed; result=18, HTTP code = 200
    atal: The remote end hung up unexpectedly
    fatal: early EOF
    

    So I've used used this instruction

    #!
    
    pip install savReaderWriter --allow-all-external
    

    I thought it would install the last version... V3.3.0 is not the last version ? If it is not, How can I get the last version in another way than using the first mentionned pip install -U -e git+https://bitbucket.org/fomcl/savreaderwriter.git#egg=savreaderwriter instruction ?

    Unfortunatly I can't send you the sav file because it's a confidential file indeed, but I really don't think the problem come from the .sav file.

    Thanks again

    Best regards, Dom

  6. Albert-Jan Roskam repo owner

    Btw, in another issue somebody pointed out that the docs say that SPSS_NO_TYPE73 should be treated as a wsrning, although the retcode > 0. I fixed that in v3.4

  7. Albert-Jan Roskam repo owner

    At least in part duplicate of issue #40, which is fixed now. Closing this issue now (finally!), but feel free to re-open it if you think this is not fixed. Locales are quite a thorny issue.

    Regards, Albert-Jan

  8. Log in to comment