On 2012/03/05 03:05 PM, Marko Limbek wrote:
Thank you!

That was easy. Now I have another problem.
I use RPy and read the spss database with method read.spss inside a
nested R code in Python, that looks like that:


import rpy

r("""

library(foreign)

baza<- read.spss(""" + analysis[0] + """)

print(baza$demo_izob0)

""")

Now when my text data labels in spss have slavic characters, they are
not recognised and output is something like that:

stiriletna srednja �ola
nedokon�ana osnovna �ola


What should I do here?


Thanks a lot,


Marko




On Mon, Mar 5, 2012 at 1:46 PM, Christian Witts<cwi...@compuscan.co.za>  wrote:
On 2012/03/05 02:37 PM, Marko Limbek wrote:

Hi everyone.


I am new to list and few months old to Python. I am writing some text
to Excel and I open the new book and try to write to the book and the
save it using

book.save

Now when I write slavic characters in the text to Excel (č, š, ž, for
instance 0xc5), I get an error, I can't save it.
I have declared appropriate encoding

# -*- coding: utf-8 -*-
# coding=<utf-8>
#!/E:/Python

and those characters appear normally in the code, but there seems to
be the problem with the function book.save.
Does anyone have any ideas, what would be the problem and how to solve
it? Some additional encoding or some changes or parameters to the
book.save method?

Is that the right forum for my question?


Thank you,

Marko
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

What package are you using to create your Excel workbook ?
If it's xlwt you can set your encoding type when you create your workbook
book = xlwt.Workbook(encoding="utf-8")
--

Christian Witts
Python Developer


Hi, you should avoid top-posting as it makes it hard to follow the thread if people have to bounce between the top and bottom of the post.

As for the answer to your question, I would suggest the R Mailing List if they have any issues with Unicode or need any encodings set when loading data etc. There was a bug with Unicode support & RPy <2.2 but that was fixed last year so if you have a recent version of RPy that shouldn't be the issue.

--

Christian Witts
Python Developer
//
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to