unicodedata not accessible?

233 views
Skip to first unread message

Joscha Feth

unread,
Apr 9, 2008, 5:48:46 PM4/9/08
to Google App Engine
Hello there,

I am new to this, but it seems as if the GAppEngine prevents me from
loading the unicodedata module:

---8<---
<type 'exceptions.ImportError'>: No module named unicodedata
---8<---

can someone confirm this?
And if yes: does anyone know a way of doing NFC normalization and
UTF-8 encoding with Python while *not* having unicodedata?

Brett

unread,
Apr 10, 2008, 2:26:08 AM4/10/08
to Google App Engine
I believe you still can do these encodings? Maybe I'm missing
something. Can you do:

"my string with non-ascii characters".encode("utf-8")

And that should work. You should also be able to load strings with
other non-ascii, non-utf-8 charsets and convert them to unicode the
same way.

Maybe you're trying to do something very advanced here, though. Could
you elaborate?

Joscha Feth

unread,
Apr 10, 2008, 2:40:29 AM4/10/08
to Google App Engine
Hi Brett,

thanks for your answer - you are right, I am still able to encode
using the normal string methods.

> Maybe you're trying to do something very advanced here, though. Could
> you elaborate?

What I try is NFC-normalizing my string:

unicodedata.normalize('NFC',string)

and as I am not able to load the unicodedata module, this is failing.

regards,
Joscha

Joscha Feth

unread,
Apr 11, 2008, 4:40:53 AM4/11/08
to Google App Engine
After finding a small comment on external libraries here:
http://code.google.com/appengine/docs/python/purepython.html
--- 8< ---
You can include other pure Python libraries with your application by
putting the code in your application directory. If you make a symbolic
link to a module's directory in your application directory, appcfg.py
will follow the link and include the module in your app.
--- 8< ---

On Windows Vista you can easily create symlinks within the command
line using *mklink*. On Windows XP there are also possibilities to do
that, see here: http://elsdoerfer.name/=ntfslink

Steps to import a library (in this example unicodedata):

1. Open up a command line (you might need to start this as
adminstrator using a right click if mklink complains about missing
rights)
2. Create your link using: mklink /d X:\path\to\your\project\pyds C:
\Python25\DLLs
3. For getting code completion working in eclipse I needed to add an
empty __init__.py to the \pyds-directory
4. import a library using: from pyds import unicodedata

Additionally some tags for searching people to find this post:
library, external libraries, import, third party libraries, python
dlls, pyd, external modules, no module named

Joscha Feth

unread,
Apr 19, 2008, 4:19:23 PM4/19/08
to Google App Engine
but be careful: when uploading your app to appspot, it won't find the
import - and instead of reporting an import error, it silently fails.

regards,
Joscha


On 11 Apr., 10:40, Joscha Feth <jos...@feth.com> wrote:
> After finding a small comment on external libraries here:http://code.google.com/appengine/docs/python/purepython.html
> --- 8< ---
> You can include other pure Python libraries with your application by
> putting the code in your application directory. If you make a symbolic
> link to a module's directory in your application directory, appcfg.py
> will follow the link and include the module in your app.
> --- 8< ---
>
> On Windows Vista you can easily create symlinks within the command
> line using *mklink*. On Windows XP there are also possibilities to do
> that, see here:http://elsdoerfer.name/=ntfslink
>
> Steps to import a library (in this example unicodedata):
>
> 1. Open up a command line (you might need to start this as
> adminstrator using a right click if mklink complains about missing
> rights)
> 2. Create your link using: mklink /d X:\path\to\your\project\pydsC:
> \Python25\DLLs
> 3. For getting code completion working in eclipse I needed to add an
> empty __init__.py to the \pyds-directory
> 4. import a library using: frompydsimport unicodedata
Reply all
Reply to author
Forward
0 new messages