From msurette at laframboise.net Thu Nov 11 18:46:31 2004 From: msurette at laframboise.net (Michael Surette) Date: Thu, 11 Nov 2004 12:46:31 -0500 Subject: [spe.pycs.net] minor installation problem (and workaround) with 0.5.1.g on Linux Message-ID: I downloaded spe from blender.org for my Linux box (Slackware 10) and when I tried to untar it I got the following message: tar: This does not look like a tar archive tar: Skipping to next header tar: Archive contains obsolescent base-64 headers tar: Read 514 bytes from /home/mikes/My Downloads/SPE-0.5.1.g-wx2.4.2.4.-bl2.31.tar.gz tar: Error exit delayed from previous errors I then tried to untar it on my Windows machine using Ultimate Zip and it worked! I then copied it to my Linux machine and installed it. Since I wanted to use the latest wxGlade (0.3.5.1) and wxPython(2.5.2.8), I went to the plugins directory and moved the wxGlade subdirectory out of the way and made wxGlade a symbolic link to my current wxglade installation. After light testing, I am happy to say that I have no spe related problems, although I do have an error message on startup: "can't open file '/usr/share/mime-info/gimp-1.3.keys'(error 2: No such file or directory)". I believe this is a gtk issue. Mike From s_t_a_n_i at yahoo.com Thu Nov 11 23:03:03 2004 From: s_t_a_n_i at yahoo.com (www.stani.be) Date: Thu, 11 Nov 2004 14:03:03 -0800 (PST) Subject: [spe.pycs.net] minor installation problem (and workaround) with 0.5.1.g on Linux In-Reply-To: Message-ID: <20041111220303.39114.qmail@web51909.mail.yahoo.com> --- Michael Surette wrote: > > I downloaded spe from blender.org for my Linux box > (Slackware 10) and when > I tried to untar it I got the following message: > > tar: This does not look like a tar archive > tar: Skipping to next header > tar: Archive contains obsolescent base-64 headers > tar: Read 514 bytes from /home/mikes/My > Downloads/SPE-0.5.1.g-wx2.4.2.4.-bl2.31.tar.gz > tar: Error exit delayed from previous errors Did you download with Mozilla/firefox? I know of this issue, but it seems to be a bug in Mozilla. If you download it with wget or something it should be fine. This warning is mentioned on http://spe.pycs.net > I then tried to untar it on my Windows machine using > Ultimate Zip and it > worked! I then copied it to my Linux machine and > installed it. Since I > wanted to use the latest wxGlade (0.3.5.1) and > wxPython(2.5.2.8), I went > to the plugins directory and moved the wxGlade > subdirectory out of the way > and made wxGlade a symbolic link to my current > wxglade installation. Next version will ship with the new wxGlade version and will be compatible with the new Blender release from sunday. > After light testing, I am happy to say that I have > no spe related > problems, Luckily because spe is supposed to run without problems on Linux. > although I do have an error message on > startup: > "can't open file > '/usr/share/mime-info/gimp-1.3.keys'(error 2: No > such > file or directory)". I believe this is a gtk issue. Yes because it doesn't look like spe would need this kind of file. Thanks for using spe, Stani __________________________________ Do you Yahoo!? Check out the new Yahoo! Front Page. www.yahoo.com From msurette at laframboise.net Mon Nov 15 15:20:17 2004 From: msurette at laframboise.net (Michael Surette) Date: Mon, 15 Nov 2004 09:20:17 -0500 Subject: [spe.pycs.net] Re: minor installation problem (and workaround) with 0.5.1.g on Linux References: <20041111220303.39114.qmail@web51909.mail.yahoo.com> Message-ID: On Thu, 11 Nov 2004 14:03:03 -0800, www.stani.be wrote: > Did you download with Mozilla/firefox? I know of this issue, but it > seems to be a bug in Mozilla. If you download it with wget or something > it should be fine. This warning is mentioned on http://spe.pycs.net Yes, I did use firefox. Unfortunately, I have problems connecting to http://spe.pycs.net > Next version will ship with the new wxGlade version and will be > compatible with the new Blender release from sunday. I look forward to it. > Thanks for using spe, > Stani Thanks for writing it. I reccomend it whenever I can. I use it to write utility sized applications and find everything that needs to be there to do the job is there, working well, with a nice intuitive interface. From ckspencer at verizon.net Tue Nov 23 06:34:39 2004 From: ckspencer at verizon.net (Chris Spencer) Date: Tue, 23 Nov 2004 00:34:39 -0500 Subject: [spe.pycs.net] Unicode Encoding? Message-ID: I'm trying to embed Japanese characters in my source using Unicode, and SPE keeps giving me: UnicodeEncodeError: 'latin-1' codec can't encode characters in position 1530-1531: ordinal not in range(256). How do you change SPE's encoding to utf-8 or utf-16? This problem caught me off-guard because I was able to embedded unicode just fine using IDLE (it even displays correctly), but then it broke when I reloaded the file in SPE. SPE is a great editor, let's not give IDLE bragging rights over it. From mail at benno-dielmann.de Tue Nov 23 10:12:51 2004 From: mail at benno-dielmann.de (Benno Dielmann) Date: Tue, 23 Nov 2004 10:12:51 +0100 Subject: [spe.pycs.net] Unicode Encoding? In-Reply-To: References: Message-ID: <200411231012.51870.mail@benno-dielmann.de> On Tuesday 23 November 2004 06:34, Chris Spencer wrote: | I'm trying to embed Japanese characters in my source using Unicode, and | SPE keeps giving me: UnicodeEncodeError: 'latin-1' codec can't encode | characters in position 1530-1531: ordinal not in range(256). How do you | change SPE's encoding to utf-8 or utf-16? This problem caught me | off-guard because I was able to embedded unicode just fine using IDLE | (it even displays correctly), but then it broke when I reloaded the file | in SPE. SPE is a great editor, let's not give IDLE bragging rights over it. Hi Chris, I'll paste in my solution to this problem which I posted to this mailing list some time ago. So here it comes: ----------------------- In fact it probably hasn't anything to do with the characters in the directory name but with that ones in your file. The reason is a "feature" in the wxStyledTextControl from wxPython Spe uses. This text control always tries to save files with the python standard encoding which happens to be ascii out of the box. If your file isn't ascii encoded (e.g. if you are using non-ascii chars in comments or strings), you get the above error. Perhaps the problem arises as well with non-ascii directory names, but I haven't tested that. The solution I found will probably work any way so here is it: In the "site-packages" directory in my python dir (/usr/lib/python/site-packages on my linux box) I created a file named "sitecustomize.py" with the following content: ----------------- import sys sys.setdefaultencoding('iso-8859-1') ----------------- This script is run automatically on python startup and sets the default encoding to 'iso-8859-1'. Please insert your appropriate encoding, e.g. 'utf-8'. Everything should work fine now. ------------------------ Have fun, Benno. From mail at benno-dielmann.de Tue Nov 23 10:12:51 2004 From: mail at benno-dielmann.de (Benno Dielmann) Date: Tue, 23 Nov 2004 10:12:51 +0100 Subject: [spe.pycs.net] Unicode Encoding? In-Reply-To: References: Message-ID: <200411231012.51870.mail@benno-dielmann.de> On Tuesday 23 November 2004 06:34, Chris Spencer wrote: | I'm trying to embed Japanese characters in my source using Unicode, and | SPE keeps giving me: UnicodeEncodeError: 'latin-1' codec can't encode | characters in position 1530-1531: ordinal not in range(256). How do you | change SPE's encoding to utf-8 or utf-16? This problem caught me | off-guard because I was able to embedded unicode just fine using IDLE | (it even displays correctly), but then it broke when I reloaded the file | in SPE. SPE is a great editor, let's not give IDLE bragging rights over it. Hi Chris, I'll paste in my solution to this problem which I posted to this mailing list some time ago. So here it comes: ----------------------- In fact it probably hasn't anything to do with the characters in the directory name but with that ones in your file. The reason is a "feature" in the wxStyledTextControl from wxPython Spe uses. This text control always tries to save files with the python standard encoding which happens to be ascii out of the box. If your file isn't ascii encoded (e.g. if you are using non-ascii chars in comments or strings), you get the above error. Perhaps the problem arises as well with non-ascii directory names, but I haven't tested that. The solution I found will probably work any way so here is it: In the "site-packages" directory in my python dir (/usr/lib/python/site-packages on my linux box) I created a file named "sitecustomize.py" with the following content: ----------------- import sys sys.setdefaultencoding('iso-8859-1') ----------------- This script is run automatically on python startup and sets the default encoding to 'iso-8859-1'. Please insert your appropriate encoding, e.g. 'utf-8'. Everything should work fine now. ------------------------ Have fun, Benno. From ckspencer at verizon.net Tue Nov 23 21:11:19 2004 From: ckspencer at verizon.net (Chris Spencer) Date: Tue, 23 Nov 2004 15:11:19 -0500 Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: <200411231012.51870.mail@benno-dielmann.de> References: <200411231012.51870.mail@benno-dielmann.de> Message-ID: Benno Dielmann wrote: > I'll paste in my solution to this problem which I posted to this mailing list > some time ago. So here it comes: [snip] Thanks, that did the trick. That and changing the font to one which supports Asian characters. Although this hack is far from streamlined. This trick assumes that all your files will conform to this encoding, ignoring Python's protocol to list the encoding at the top of the file, e.g. # -*- coding: utf-8 -*- for utf-8. It'd be nice to have a drop-down menu that let's you select an encoding, akin to a web-browser, or let the SPE auto-detect the encoding for each file. From s_t_a_n_i at yahoo.com Wed Nov 24 02:12:39 2004 From: s_t_a_n_i at yahoo.com (www.stani.be) Date: Tue, 23 Nov 2004 17:12:39 -0800 (PST) Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: Message-ID: <20041124011239.8295.qmail@web51906.mail.yahoo.com> --- Chris Spencer wrote: > Benno Dielmann wrote: > > > I'll paste in my solution to this problem which I > posted to this mailing list > > some time ago. So here it comes: > [snip] > > Thanks, that did the trick. That and changing the > font to one which > supports Asian characters. Although this hack is far > from streamlined. > This trick assumes that all your files will conform > to this encoding, > ignoring Python's protocol to list the encoding at > the top of the file, > e.g. # -*- coding: utf-8 -*- for utf-8. It'd be nice > to have a drop-down > menu that let's you select an encoding, akin to a > web-browser, That's what I started to think of implementing: a drop down list in the preferences dialog box. Which list should it consist of? What are common encoding formats? Is there somewhere a list on the internet? Suggestions are welcome. What I also could do is that spe changes the default encoding to the value of the preference box and restore the previous value when spe exits. > or let > the SPE auto-detect the encoding for each file. Is there any python library/algorithm for this. It seems a bit risky to me. By the way I'm looking still for Mac Os X users to perform some tests. Stani http://spe.pycs.net http://www.stani.be __________________________________ Do you Yahoo!? Yahoo! Mail - You care about security. So do we. http://promotions.yahoo.com/new_mail From ckspencer at verizon.net Wed Nov 24 06:40:50 2004 From: ckspencer at verizon.net (Chris Spencer) Date: Wed, 24 Nov 2004 00:40:50 -0500 Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: <20041124011239.8295.qmail@web51906.mail.yahoo.com> References: <20041124011239.8295.qmail@web51906.mail.yahoo.com> Message-ID: www.stani.be wrote: > That's what I started to think of implementing: a drop > down list in the preferences dialog box. Which list > should it consist of? What are common encoding > formats? Is there somewhere a list on the internet? > Suggestions are welcome. Well, you should probably only worry about what's listed at: http://docs.python.org/lib/node127.html since those are the encodings Python supports by default. There might be more, but that's a good place to start. > What I also could do is that spe changes the default > encoding to the value of the preference box and > restore the previous value when spe exits. > > >>or let >>the SPE auto-detect the encoding for each file. > > Is there any python library/algorithm for this. It > seems a bit risky to me. I'm not sure. Auto-detecting the encoding from scratch is practically impossible, but what Firefox does is allow you to narrow the field to say, "Auto-detect Japanese", and then it tries to determine which of the 3 or 4 Japanese encodings should be used. Of course, this isn't absolutely necessary. Just allowing the user to select the encoding manually should be fine for most cases. From ckspencer at verizon.net Wed Nov 24 07:36:06 2004 From: ckspencer at verizon.net (Chris Spencer) Date: Wed, 24 Nov 2004 01:36:06 -0500 Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: References: <20041124011239.8295.qmail@web51906.mail.yahoo.com> Message-ID: Chris Spencer wrote: > www.stani.be wrote: > >> That's what I started to think of implementing: a drop >> down list in the preferences dialog box. Which list >> should it consist of? What are common encoding >> formats? Is there somewhere a list on the internet? >> Suggestions are welcome. > > > Well, you should probably only worry about what's listed at: > http://docs.python.org/lib/node127.html > since those are the encodings Python supports by default. There might be > more, but that's a good place to start. > >> What I also could do is that spe changes the default >> encoding to the value of the preference box and >> restore the previous value when spe exits. >> >> >>> or let the SPE auto-detect the encoding for each file. >> >> >> Is there any python library/algorithm for this. It >> seems a bit risky to me. > > > I'm not sure. Auto-detecting the encoding from scratch is practically > impossible, but what Firefox does is allow you to narrow the field to > say, "Auto-detect Japanese", and then it tries to determine which of the > 3 or 4 Japanese encodings should be used. Of course, this isn't > absolutely necessary. Just allowing the user to select the encoding > manually should be fine for most cases. Also, I just checked and some Unicode may not appear correctly in the shell panel if the font doesn't support the characters. In this case, the current font cannot display Asian characters. Is it possible to allow the shell's font to be changed? From s_t_a_n_i at yahoo.com Wed Nov 24 14:35:47 2004 From: s_t_a_n_i at yahoo.com (www.stani.be) Date: Wed, 24 Nov 2004 05:35:47 -0800 (PST) Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: Message-ID: <20041124133547.88503.qmail@web51908.mail.yahoo.com> --- Chris Spencer wrote: > Also, I just checked and some Unicode may not appear > correctly in the > shell panel if the font doesn't support the > characters. In this case, > the current font cannot display Asian characters. Is > it possible to > allow the shell's font to be changed? As far as I know, the shell is also an STC control, so it should be possible. Which font do you suggest? Stani http://spe.pycs.net http://www.stani.be __________________________________ Do you Yahoo!? All your favorites on one personal page ? Try My Yahoo! http://my.yahoo.com From mail at benno-dielmann.de Wed Nov 24 15:30:40 2004 From: mail at benno-dielmann.de (Benno Dielmann) Date: Wed, 24 Nov 2004 15:30:40 +0100 Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: References: <200411231012.51870.mail@benno-dielmann.de> Message-ID: <200411241530.40670.mail@benno-dielmann.de> On Tuesday 23 November 2004 21:11, Chris Spencer wrote: | Benno Dielmann wrote: | > I'll paste in my solution to this problem which I posted to this mailing | > list some time ago. So here it comes: | | [snip] | | Thanks, that did the trick. That and changing the font to one which | supports Asian characters. Although this hack is far from streamlined. | This trick assumes that all your files will conform to this encoding, | ignoring Python's protocol to list the encoding at the top of the file, | e.g. # -*- coding: utf-8 -*- for utf-8. It'd be nice to have a drop-down | menu that let's you select an encoding, akin to a web-browser, or let | the SPE auto-detect the encoding for each file. Does this really ignore the # -*- coding: ... - string at the top of the file? As far as I understand it sets the default encoding which applies if there isn't any encoding specified (i.e. no such coding string). Why couldn't spe just (auto-)detect the encoding by parsing this coding string instead of the user manually selecting the encoding in some drop-down box? One whould just have to put the proper coding-string on top of each file which is recommended anyway, I think. Python (2.3) prints a deprecation warning anyway if there are non-ascii characters in the file and no encoding specified. Perhaps spe could support the user constructing the coding-string. There we have the drop-down box again ;-). But this box whould just construct a proper python coding string and past it in the right place in the file. What do you think about it? Have fun, Benno. From s_t_a_n_i at yahoo.com Wed Nov 24 15:53:20 2004 From: s_t_a_n_i at yahoo.com (www.stani.be) Date: Wed, 24 Nov 2004 06:53:20 -0800 (PST) Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: <200411241530.40670.mail@benno-dielmann.de> Message-ID: <20041124145320.4484.qmail@web51902.mail.yahoo.com> --- Benno Dielmann wrote: > On Tuesday 23 November 2004 21:11, Chris Spencer > wrote: > | Benno Dielmann wrote: > | > I'll paste in my solution to this problem which > I posted to this mailing > | > list some time ago. So here it comes: > | > | [snip] > | > | Thanks, that did the trick. That and changing the > font to one which > | supports Asian characters. Although this hack is > far from streamlined. > | This trick assumes that all your files will > conform to this encoding, > | ignoring Python's protocol to list the encoding at > the top of the file, > | e.g. # -*- coding: utf-8 -*- for utf-8. It'd be > nice to have a drop-down > | menu that let's you select an encoding, akin to a > web-browser, or let > | the SPE auto-detect the encoding for each file. > > Does this really ignore the # -*- coding: ... - > string at the top of the file? > As far as I understand it sets the default encoding > which applies if there > isn't any encoding specified (i.e. no such coding > string). > > Why couldn't spe just (auto-)detect the encoding by > parsing this coding string > instead of the user manually selecting the encoding > in some drop-down box? > One whould just have to put the proper coding-string > on top of each file > which is recommended anyway, I think. Python (2.3) > prints a deprecation > warning anyway if there are non-ascii characters in > the file and no encoding > specified. > > Perhaps spe could support the user constructing the > coding-string. There we > have the drop-down box again ;-). But this box > whould just construct a proper > python coding string and past it in the right place > in the file. > > What do you think about it? Seems interesting. I'm now at the moment implementing the general spe encoding preference settings, which is still handy for source code which doesn't provide this encode comment. This now the code in the save method of _spe/Child.py: source=self.source.GetText() if self.parentPanel.getValue('StripTrailingSpaces'): source='\n'.join([l.rstrip() for l in source.split('\n')]) content = str(source.replace('\r\n','\n')) if not self.dosLines: #convert to Unix lines content = str(source.replace('\r\n','\n')) #Note that the mode here must be "wb" to allow #line endings to be preserved. file = open(str(self.fileName),'wb') file.write(content) file.close() Let's suppose e.g. the encoding is utf-16... Should than the change be?: file.write(content.encode('utf-16')) And than how about opening files, now in the openList method in _spe/Parent.py: source=open(fileName).read() Should this than figure out this comment line and apply afterwards: source = source.decode('utf-16') Stani http://spe.pycs.net http://www.stani.be __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com From ckspencer at verizon.net Wed Nov 24 16:37:26 2004 From: ckspencer at verizon.net (Chris Spencer) Date: Wed, 24 Nov 2004 10:37:26 -0500 Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: <20041124133547.88503.qmail@web51908.mail.yahoo.com> References: <20041124133547.88503.qmail@web51908.mail.yahoo.com> Message-ID: www.stani.be wrote: > --- Chris Spencer wrote: > >>Also, I just checked and some Unicode may not appear >>correctly in the >>shell panel if the font doesn't support the >>characters. In this case, >>the current font cannot display Asian characters. Is >>it possible to >>allow the shell's font to be changed? > > As far as I know, the shell is also an STC control, so > it should be possible. Which font do you suggest? Under Windows, MS Mincho handles Asian characters, but not everyone may want this for normal ascii. It'd be best if there was a way to choose this font in the preferences just like you would for the editor windows. From ckspencer at verizon.net Thu Nov 25 07:42:15 2004 From: ckspencer at verizon.net (Chris Spencer) Date: Thu, 25 Nov 2004 01:42:15 -0500 Subject: [spe.pycs.net] Re: Unicode Encoding? In-Reply-To: References: <20041124133547.88503.qmail@web51908.mail.yahoo.com> Message-ID: Chris Spencer wrote: > www.stani.be wrote: > >> --- Chris Spencer >> wrote: >> >>> Also, I just checked and some Unicode may not appear >>> correctly in the shell panel if the font doesn't support the >>> characters. In this case, the current font cannot display Asian >>> characters. Is >>> it possible to allow the shell's font to be changed? >> >> >> As far as I know, the shell is also an STC control, so >> it should be possible. Which font do you suggest? > > > Under Windows, MS Mincho handles Asian characters, but not everyone may > want this for normal ascii. It'd be best if there was a way to choose > this font in the preferences just like you would for the editor windows. Btw, I've playing around with changing the fonts and font sizes and I'm getting some real strange behavior. When you change a font the change isn't applied uniformly. Some lines have different font sizes. Some words are in different fonts. You're forced to close and reopen the document for the changes to appear correctly.