Trouble writing txt

2009-01-21 Thread bilgin arslan
Hello,
I am trying to write a list of words to into a text file as two
colons: word (tab) len(word)
such as

standart8

I have no trouble writing the words but I couldn't write integers. I
always get strange characters, such as:

GUN
㐊娀䄀䴀䄀一ഀ਀5COCUK
㐊䬀䄀䐀䤀一ഀ਀5EV
...
㜊夀䄀䴀䄀ഀ਀4YATSI
㔊娀䤀䰀䜀䤀吀ഀ਀�

(the integers also seem to be incorrect)
I use the following form inside a loop to produce this
current = unicode(word)++str(len(word))
ofile.write(current)

I know about struct and I tried to used it but somehow I always got a
blank character instead of an int.

import struct
format = i
data = struct.pack(format, 24)
print data

Any ideas?
I use macosx and eclipse. The code also uses unicode encoding
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python Imaging Library and textmate

2009-01-09 Thread bilgin arslan
Hi Philip,
I tried to install PIL with the directions given and it seemed to be ok.

When I tried it with IDLE, import Image did not give an error and as
far as I checked it seemed to be working.
However, importing Image module in TextMate gives an error, saying
that the module cannot be found for some strange reason.

The code simply contains the line *import Image* in both cases


On Jan 9, 2009, at 2:49 AM, bilgin arslan wrote:

* Hello,
** I am a beginner in python and I am trying to create image files that
** contain
** lines from a text file.
** I am trying to do this with PIL, which seems like a suitable tool. I
** have a
** copy of TextMate(1.5.8) and I run Macosx 10.5.6
**
** The problem is, even though I installed PIL correctly (I get no
** errors from
** import Image in IDLE or in terminal), I can't get TextMate to
** import the
** module.
** I keep getting ImportError: No module named Image error.
** I tried reloading TextMate's bundles but that did not work either.
*
I use TextMate but I don't know what you mean when you say you can't
get TM to import a module. Can you give a little more context?


* There was a similar thread in this list with textmate but I can't
** understand
** how that issue was solved in the end.
*
link?



bye
Philip
--
http://mail.python.org/mailman/listinfo/python-list


Python Imaging Library and textmate

2009-01-08 Thread bilgin arslan
Hello,
I am a beginner in python and I am trying to create image files that contain
lines from a text file.
I am trying to do this with PIL, which seems like a suitable tool. I have a
copy of TextMate(1.5.8) and I run Macosx 10.5.6

The problem is, even though I installed PIL correctly (I get no errors from
import Image in IDLE or in terminal), I can't get TextMate to import the
module.
I keep getting ImportError: No module named Image error.
I tried reloading TextMate's bundles but that did not work either.

I used this set of instructions to install PIL
http://www.p16blog.com/p16/2008/05/appengine-installing-pil-on-os-x-1053.html

I think there is something wrong with symbolic links, although I am also a
novice to UNIX based systems so I do not know for sure what to do about it.
There was a similar thread in this list with textmate but I can't understand
how that issue was solved in the end.
Thanks
Ali
--
http://mail.python.org/mailman/listinfo/python-list