Install Mac OS X - Idle doesn't show up
Hello, Sorry bothering you with such a trivial problem. I installed python on a new mac at office. It seems everything is fine: in the console, I access to python. But I just can't start Idle. It seems to open but closes immediately (it appears in the dock and closes immediately). It is also impossible to open any .py file. I am sure some of you have a good idea of what to do (path,...). Thanks in advance Dominique -- http://mail.python.org/mailman/listinfo/python-list
Re: Install Mac OS X - Idle doesn't show up
Dominique gmail.com> writes: > > One precision: When I go in the console and type idle, it works: idle appears. But I would like to be able to launch idle from the dock Dominique -- http://mail.python.org/mailman/listinfo/python-list
Re: Install Mac OS X - Idle doesn't show up
Kevin Walzer codebykevin.com> writes: > > > > How did you install/build Python? On the Mac, you really aren't supposed > to start it from the terminal unless you are running it under X11 or are > using a non-framework build. If you built it the standard Mac way, or if > you use the binary installer from python.org, Idle is installed in > /Applications/MacPython 2.5. Look there, and you should be able to drag > the Idle icon to the dock. > Hum Hum Hum... That's what I did. It did not work. Now yes. ???! I should have dreamt. I don't understand Thank you Kevin for your help Dominique -- http://mail.python.org/mailman/listinfo/python-list
How to convert a ">" into a >
Hello All, In a wx GUI, I would like to let the user choose between >, < or =. So, I created a combobox and when the user chooses ">" for instance, I wanted to return > (the objective is to send the operator into another complex method): Example: if variable == ">": return > But this is invalid syntax. How can I transform a ">" into the > operator ie without parenthesis, so that I can load it into another function ? Thanks in advance Dominique -- http://mail.python.org/mailman/listinfo/python-list
Re: How to convert a ">" into a >
On Jun 21, 1:37 pm, John Machin <[EMAIL PROTECTED]> wrote:
>
> Look at the operator module. In your above example:
>
> return {
>'>': operator.gt,
>'=': operator.eq,
>'<': operator.lt,
>}[variable]
>
> Cheers,
> John
Thanks a lot John
Dominique
--
http://mail.python.org/mailman/listinfo/python-list
Re: How to convert a ">" into a >
On Jun 22, 6:45 am, Tim Roberts <[EMAIL PROTECTED]> wrote:
> dominique <[EMAIL PROTECTED]> wrote:
> >On Jun 21, 1:37 pm, John Machin <[EMAIL PROTECTED]> wrote:
>
> >> Look at the operator module. In your above example:
>
> >> return {
> >>'>': operator.gt,
> >>'=': operator.eq,
> >>'<': operator.lt,
> >>}[variable]
>
> >Thanks a lot John
> >Dominique
>
> Yes, but you need to remember that what you are getting is not literally an
> operator. That is, if you store that return value in a variable called
> "op", you can't say this:
>
> if x op y:
>
>
> Instead, what you have is a function, so you'll have to write it:
>
> if op( x, y ):
> --
> Tim Roberts, [EMAIL PROTECTED]
> Providenza & Boekelheide, Inc.
Thanks for the tip.
Dominique
--
http://mail.python.org/mailman/listinfo/python-list
Python and VT100
Using Python (Command line version, not IDLE, nor pythonwin) With Linux, print "\033[33mHello" prints a brown hello. Fine! With Windows, the VT100 sequence seems to be unknown? Why? and how can I correct that? Thanks -- http://mail.python.org/mailman/listinfo/python-list
Unicode in cgi-script with apache2
Hi,
I've got a little script:
#!/usr/bin/env python3
print("Content-Type: text/html")
print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1
print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past
print("")
f = open("/var/www/cgi-data/index.html", "r")
for line in f:
print(line,end='')
If I run the script in the terminal, it nicely prints the webpage
'index.html'.
If access the script through a webbrowser, apache gives an error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1791: ordinal not in range(128)
I've done a hole afternoon of reading on fora and blogs, I don't have a
solution.
Can anyone help me?
Greetings,
Dominique.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Unicode in cgi-script with apache2
I fond my problem, I will describe it more at the bottom of this message...
But first...
Thanks Alister for the tips:
1) This evening, I've researched WSGI. I found that WSGI is more
advanced than CGI and I also think WSGI is more the Python way. I'm an
amateur playing around with my imagination on a small virtual server
(online cloudserver.ramaekers-stassart.be). I'm trying to build
something rather specific. I also like to make things as basic as
possible. My first thought was not to use a framework. This because with
a framework I didn't really know what the code is doing. For a
framework, for me, would be a black-box. But after inspecting WSGI, I
got the idea not to make it myself more difficult than it has to be. I
will work with a framework and I think I'll put my chances on Falcon
(for it's speed, small size and it doesn't seem to difficult)... There
are a lot of frameworks, so if someone wants to point me to an other
framework, I'm open to suggestions...
2) Your tip, to use 'encode' did not solve the problem and created a new
one. My lines were incapsulted in quotes and I got a lot of \b's and
\n's... and I still got the same error.
3) I didn't got the message from JMF, so...
What seems to be the problem:
My Script was ok. I know this because in the terminal I got my expected
output. Python3 uses UTF-8 coding as a standard. The problem is, when
python 'prints' to the apache interface, it translates the string to
ascii. (Why, I never found an answer). Somewhere in the middle of my
index.html file, there are letters like ë and ü. If Python tries to
translate these, Python throws an error. If I delete these letters in
the file, the script works perfectly in a browser! In Python2.7 the
script can easily be tweaked so the translation to ascii isn't done, but
in Python3, its a real pain in the a... I've read about people who
managed to force Python3 to 'print' to apache in UTF-8, but none of
their solutions worked for me.
I think the programmers of Python doesn't want to focus on Python +
apache + CGI (I think it only happens with apache and not with an other
http-server). I don't think they do this intentional but I guess they
assume that if you use Python to make a web-application, you also use
mod_wsgi or mod_python (in apache)...
So I'll use wsgi, It's a little more work but it seems really neat...
grtz
Op 15-08-14 om 21:27 schreef alister:
On Fri, 15 Aug 2014 20:10:25 +0200, Dominique Ramaekers wrote:
Hi,
I've got a little script:
#!/usr/bin/env python3 print("Content-Type: text/html")
print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1
print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past
print("")
f = open("/var/www/cgi-data/index.html", "r")
for line in f:
print(line,end='')
If I run the script in the terminal, it nicely prints the webpage
'index.html'.
If access the script through a webbrowser, apache gives an error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1791: ordinal not in range(128)
I've done a hole afternoon of reading on fora and blogs, I don't have a
solution.
Can anyone help me?
Greetings,
Dominique.
1) this is not the way to get python to generate a web page, if you dont
want to use an existing framework (for example if you are doing this ans
an educational exercise) i suggest to google SWGI
2) you need to encode your output strings into a format apache/html
protocols can support - UTF8 is probably best here.
change your pint function to
print(line.encode('utf'),end='')
3) Ignore any subsequent advice from JMF even when he is trying to help
he is invariable wrong.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Unicode in cgi-script with apache2
Hi John,
The error is in the line "print(line,end='')"... and it only happens
when the script is started from a webbrowser. In the terminal, the
script works fine.
See my previous mail for my findings after a lot of reading and trying...
grz
Op 15-08-14 om 21:32 schreef John Gordon:
In Dominique Ramaekers
writes:
#!/usr/bin/env python3
print("Content-Type: text/html")
print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1
print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past
print("")
f = open("/var/www/cgi-data/index.html", "r")
for line in f:
print(line,end='')
If access the script through a webbrowser, apache gives an error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1791: ordinal not in range(128)
The error traceback should display exactly where the error occurs within
the script. Which line is it?
--
https://mail.python.org/mailman/listinfo/python-list
Re: Unicode in cgi-script with apache2
Hi Peter,
Your code seems interesting.
I've tried using sys.stdout (in a slightly different form) but it gave
the same error.
I also read about people who fixed the error by changing the servers
locale to en_US.UTF-8. The people who posted these fixes also said that
you can only use en_US.UTF-8 (and not ex. nl_BE.UTF8)... Anyway, It
didn't work for me. And I find this a dirty fix because, I don't want to
use US locale...
Please excuse me not to try out your specific solutions. I've already
started to implement WSGI over CGI. See my previous message...
grz
Op 16-08-14 om 13:17 schreef Peter Otten:
Dominique Ramaekers wrote:
I've got a little script:
#!/usr/bin/env python3
print("Content-Type: text/html")
print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1
print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past
print("")
f = open("/var/www/cgi-data/index.html", "r")
for line in f:
print(line,end='')
If I run the script in the terminal, it nicely prints the webpage
'index.html'.
If access the script through a webbrowser, apache gives an error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1791: ordinal not in range(128)
I've done a hole afternoon of reading on fora and blogs, I don't have a
solution.
Can anyone help me?
If the input and output encoding are the same you can avoid the byte-to-text
(and subsequent text-to-byte conversion) and serve the binary contents of
the index.html file directly:
#!/usr/bin/env python3
import sys
print("Content-Type: text/html")
print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1
print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past
print("")
sys.stdout.flush()
with open("/var/www/cgi-data/index.html", "rb") as f:
for line in f:
sys.stdout.buffer.write(line)
The flush() is necessary to write pending data before accessing the lowlevel
stdout.buffer. Instead of the loop you can use any of these:
sys.stdout.buffer.write(f.read()) # not for huge files, but should be OK for
# typical html file sizes
sys.stdout.buffer.writelines(f)
shutil.copyfileobj(f, sys.stdout.buffer) # show off your knowledge
# of the stdlib ;)
Alternatively you could choose an encoding via the locale:
#!/usr/bin/env python3
import locale
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
print("Content-Type: text/html")
print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1
print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past
print("")
with open("/var/www/cgi-data/index.html") as f:
for line in f:
print(line, end='')
Python should then use UTF-8 as the default for i/o and the resulting
scripts looks more familiar.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Unicode in cgi-script with apache2
Hi Denis,
This error is a python error displayed in the apache error log. The
complete message is:
[Sat Aug 16 23:12:42.158326 2014] [cgi:error] [pid 29327] [client
119.63.193.196:0] AH01215: Traceback (most recent call last):
[Sat Aug 16 23:12:42.158451 2014] [cgi:error] [pid 29327] [client
119.63.193.196:0] AH01215: File "/var/www/cgi-python/index.html",
line 12, in
[Sat Aug 16 23:12:42.158473 2014] [cgi:error] [pid 29327] [client
119.63.193.196:0] AH01215: for line in f:
[Sat Aug 16 23:12:42.158526 2014] [cgi:error] [pid 29327] [client
119.63.193.196:0] AH01215: File
"/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
[Sat Aug 16 23:12:42.158569 2014] [cgi:error] [pid 29327] [client
119.63.193.196:0] AH01215: return codecs.ascii_decode(input,
self.errors)[0]
[Sat Aug 16 23:12:42.158663 2014] [cgi:error] [pid 29327] [client
119.63.193.196:0] AH01215: UnicodeDecodeError: 'ascii' codec can't
decode byte 0xc3 in position 1791: ordinal not in range(128)
If I access the file index.html directly from the brower, It renders fine...
I've done a lot of testing. I put my findings in a previous message.
Thanks anyway.
grz
Op 16-08-14 om 18:40 schreef Denis McMahon:
On Fri, 15 Aug 2014 20:10:25 +0200, Dominique Ramaekers wrote:
#!/usr/bin/env python3
print("Content-Type: text/html")
print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1
print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past
print("")
f = open("/var/www/cgi-data/index.html", "r")
for line in f:
print(line,end='')
If I run the script in the terminal, it nicely prints the webpage
'index.html'.
If access the script through a webbrowser, apache gives an error:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
1791: ordinal not in range(128)
Is this a message appearing in the apache error log or in the browser? If
it is appearing in the browser, this is probably apache passing through a
python error message.
Is this the complete error message?
What happens when you try and access http://[server]/cgi-data/index.html
directly in a web browser? You may need to copy the file to a different
directory to do this depending on the apache configuration.
--
https://mail.python.org/mailman/listinfo/python-list
Re: Unicode in cgi-script with apache2
* My system is a linux-box. * I've tried using encoding="utf-8". It didn't fix things. * That print uses sys.stdout would explain, using sys.stdout isn't better. * My locale and the system-wide locale is UTF-8. Using SetEnv PYTHONIOENCODING utf-8 didn't fix things * The file is encoded UTF-8... I can not speak for anybody else but in my search I don't believe to have read about someone who had the problem on a Windows-system. They all used linux (different kinds of flavors) or OS-X... This is the first time I've encountered a situation where Windows is better in encoding issues :P +1 for Microsoft... I think that Apache (*nix versions) doesn't tell Python, she's accepting UTF-8. Or Python doesn't listen right... Maybe I should place a bug report in both projects? Op 17-08-14 om 04:50 schreef Denis McMahon: On Sun, 17 Aug 2014 00:36:14 +0200, Dominique Ramaekers wrote: What seems to be the problem: My Script was ok. I know this because in the terminal I got my expected output. Python3 uses UTF-8 coding as a standard. The problem is, when python 'prints' to the apache interface, it translates the string to ascii. (Why, I never found an answer). Is the apache server running on a linux or a windows platform? The problem may not be python, it may be the underlying OS. I wonder if apache is spawning a process for python though, and if so whether it is in some way constraining the character set available to stdout of the spawned process. From your other message, the error appears to be a python error on reading the input file. For some reason python seems to be trying to interpret the file it is reading as ascii. I wonder if specifying the binary data parameter and / or utf-8 encoding when opening the file might help. eg: f = open( "/var/www/cgi-data/index.html", "rb" ) f = open( "/var/www/cgi-data/index.html", "rb", encoding="utf-8" ) f = open( "/var/www/cgi-data/index.html", "r", encoding="utf-8" ) I've managed to drive down a bit further in the problem: print() goes to sys.stdout This is part of what the docs say about sys.stdout: """ The character encoding is platform-dependent. Under Windows, if the stream is interactive (that is, if its isatty() method returns True), the console codepage is used, otherwise the ANSI code page. Under other platforms, the locale encoding is used (see locale.getpreferredencoding ()). Under all platforms though, you can override this value by setting the PYTHONIOENCODING environment variable before starting Python. """ At this point, details of the OS become very significant. If your server is running on a windows platform you may need to figure out how to make apache set the PYTHONIOENCODING environment variable to "utf-8" (or whatever else is appropriate) before calling the python script. I believe that the following line in your httpd.conf may have the required effect. SetEnv PYTHONIOENCODING utf-8 Of course, if the file is not encoded as utf-8, but rather something else, then use that as the encoding in the above suggestions. If the server is not running windows, then I'm not sure where the problem might be. -- https://mail.python.org/mailman/listinfo/python-list
Re: Unicode in cgi-script with apache2
Wow, everybody keeps on chewing on this problem. As a bonus, I've reconfigured my server to do some testings. http://cloudserver.ramaekers-stassart.be/test.html => is the file I want to read. Going to this url displays the file... http://cloudserver.ramaekers-stassart.be/cgi-python/encoding1 => is the cgi-script of this test http://cloudserver.ramaekers-stassart.be/wsgi => is the wsgi sollution (but for now it just says 'Hello world'...) This configuration----- dominique@cloudserver:/var/www/cgi-python$ cat /etc/default/locale LANG="en_US.UTF-8" LANGUAGE="en_US:" dominique@cloudserver:/var/www/cgi-python$ cat /etc/apache2/sites-enabled/000-default.conf ServerAdmin [email protected] WSGIScriptAlias /wsgi /var/www/wsgi/application Order allow,deny Allow from all DocumentRoot /var/www/html ScriptAlias /cgi-python /var/www/cgi-python/ Options ExecCGI SetHandler cgi-script ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined dominique@cloudserver:/var/www/cgi-python$ cat encoding1 #!/usr/bin/env python3 print("Content-Type: text/html") print("Cache-Control: no-cache, must-revalidate")# HTTP/1.1 print("Expires: Sat, 26 Jul 1997 05:00:00 GMT") # Date in the past print("") f = open("/var/www/html/test.html", "r") for line in f: print(line,end='') dominique@cloudserver:/var/www/cgi-python$ cat ../html/test.html Testing my cgi... Ok, Testing my cgi... Lets try some characters: é ë ü dominique@cloudserver:/var/www/cgi-python$ file ../html/test.html ../html/test.html: HTML document, UTF-8 Unicode text -Start test-- In brower: http://cloudserver.ramaekers-stassart.be/test.html => page displays ok (try it yourself...) In terminal: => all go's wel dominique@cloudserver:/var/www/cgi-python$ ./encoding1 Content-Type: text/html Cache-Control: no-cache, must-revalidate Expires: Sat, 26 Jul 1997 05:00:00 GMT Testing my cgi... Ok, Testing my cgi... Lets try some characters: é ë ü In the browser (firefox): http://cloudserver.ramaekers-stassart.be/cgi-python/encoding1 => gives a blank page! The error log says: root@cloudserver:~# cat /var/log/apache2/error.log | tail -n 6 [Sun Aug 17 11:09:21.102003 2014] [cgi:error] [pid 32146] [client 84.194.120.161:36707] AH01215: Traceback (most recent call last): [Sun Aug 17 11:09:21.102129 2014] [cgi:error] [pid 32146] [client 84.194.120.161:36707] AH01215: File "/var/www/cgi-python/encoding1", line 7, in [Sun Aug 17 11:09:21.102149 2014] [cgi:error] [pid 32146] [client 84.194.120.161:36707] AH01215: for line in f: [Sun Aug 17 11:09:21.102201 2014] [cgi:error] [pid 32146] [client 84.194.120.161:36707] AH01215: File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode [Sun Aug 17 11:09:21.102243 2014] [cgi:error] [pid 32146] [client 84.194.120.161:36707] AH01215: return codecs.ascii_decode(input, self.errors)[0] [Sun Aug 17 11:09:21.102318 2014] [cgi:error] [pid 32146] [client 84.194.120.161:36707] AH01215: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 162: ordinal not in range(128) --Conclusion- In my current configuration, the bug is recreated!!! ---Test 2: new configuration- I change the line f = open("/var/www/html/test.html", "r") into f = open("/var/www/html/test.html", "r", encoding="utf-8") and save the script as encoding2 In the terminal: => All ok In the browser: => blank page!!! Error log in apache: root@cloudserver:~# cat /var/log/apache2/error.log | tail -n 4 [Sun Aug 17 11:13:47.372353 2014] [cgi:error] [pid 32147] [client 84.194.120.161:36711] AH01215: Traceback (most recent call last): [Sun Aug 17 11:13:47.372461 2014] [cgi:error] [pid 32147] [client 84.194.120.161:36711] AH01215: File "/var/www/cgi-python/encoding2", line 8, in [Sun Aug 17 11:13:47.372483 2014] [cgi:error] [pid 32147] [client 84.194.120.161:36711] AH01215: print(line,end='') [Sun Aug 17 11:13:47.372572 2014] [cgi:error] [pid 32147] [client 84.194.120.161:36711] AH01215: UnicodeEncodeError: 'ascii' codec can't encode character '\\xe9' in position 51: ordinal not in range(128) -Conclusion-- Steven was right. It was a read error => with encoding2 script the file is read in UTF-8. Dough, I find it strange. The file is in UTF-8 and Python3 has UTF-8 as standard. But reading the file is fixed. Now the writing is still broken Here are some tests hinted before: Tip from Steven =>
Re: Unicode in cgi-script with apache2
Yes, even a restart not just reload. I Also put it in the section as in the main apache2.conf Op 17-08-14 om 13:04 schreef Peter Otten: Dominique Ramaekers wrote: Putting the lines in my apache config: AddDefaultCharset UTF-8 SetEnv PYTHONIOENCODING utf-8 Cleared my brower-cache... No change. Did you restart the apache? -- https://mail.python.org/mailman/listinfo/python-list
Re: Unicode in cgi-script with apache2
As I suspected, if I check the used encoding in wsgi I get:
ANSI_X3.4-1968
I found you can define the coding of the script with a special comment:
# -*- coding: utf-8 -*-
Now I don't get an error but my special chars still doesn't display well.
The script:
# -*- coding: utf-8 -*-
import sys
def application(environ, start_response):
status = '200 OK'
output = 'Hello World! é ü à ũ'
#output = sys.getfilesystemencoding() #1
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
Gives in the browser as output:
Hello World! é ü à ũ
And if I check the encoding with the python script (uncommenting line
#1), I still get ANSI_X3.4-1968
This is really getting on my nerves.
Op 17-08-14 om 13:04 schreef Peter Otten:
Dominique Ramaekers wrote:
Putting the lines in my apache config:
AddDefaultCharset UTF-8
SetEnv PYTHONIOENCODING utf-8
Cleared my brower-cache... No change.
Did you restart the apache?
--
https://mail.python.org/mailman/listinfo/python-list
Pyrex installation on windows XP: step-by-step guide
Bravo pour le guide d'installation! Je suppose que vous parlez français. J'ai installé pyrex suivant vos conseils tout se passe normalement l'exemple primes est installé dans /Lib/site_packages/primes.pyd le programme a été compilé mais je n'arrive pas à faore le test le module n'est pas reconnu: >>> primes Traceback (most recent call last): File "", line 1, in -toplevel- primes NameError: name 'primes' is not defined que se passe-t-il? cela doit sans doute être trivial merci de me répondre Dominique Pignon-- http://mail.python.org/mailman/listinfo/python-list
Problem with PARAGRAPH SEPARATOR
Hello everyone I'm doing a transformation with (MSXML) from a xml file to a tex file (actually it's just output format "text" with tex commands inside). The output of the transformation (a big string containg the whole file) contains a so called 'paragraph separator' (unicode: 2029). If I want to pring that string (file) to the std out or a file object then I get a "UnicodeError" saying that the unicode 2029 can't be encoded... Can anyone please tell me how I should handle that paragraph seperator? I must say, that I don't even know WHY my output file has such a character but I'd kinda like to keep it there and just be able to store the string in a file object / print it to console... Thanks in advance Dominique * This e-mail and any files attached are strictly confidential, may be legally privileged and are intended solely for the addressee. If you are not the intended recipient please notify the sender immediately by return email and then delete the e-mail and any attachments immediately. The views and or opinions expressed in this e-mail are not necessarily the views of De La Rue plc or any of its subsidiaries and the De La Rue Group of companies, their directors, officers and employees make no representation about and accept no liability for its accuracy or completeness. You should ensure that you have adequate virus protection as the De La Rue Group of companies do not accept liability for any viruses De La Rue plc Registered No.3834125, De La Rue Holdings plc Registered No 58025 and De La Rue International Limited Registered No 720284 are all registered in England with their registered office at: De La Rue House, Jays Close, Viables, Hampshire RG22 4BS -- http://mail.python.org/mailman/listinfo/python-list
RE: Problem with PARAGRAPH SEPARATOR
Actually that's what I tried to do, for example:
outputString = myString.encode('iso-8859-1','ignore')
However, I always get such messages (the character, that's causing problems
varies, but its always higher than 127 ofc...)
'ascii' codec can't decode byte 0xc3 in position 51: ordinal not in range(128)
It doesn't matter what encoding I use (tried 'utf-8' 'utf-16' 'latin_1' and the
iso one). The debugger is showing all the special characters (from french and
german language) so I'm wondering why there's still the message about the
'ascii' codec...
Would that mean that the string "myString" is an ascii-string or what?
-Original Message-
From: Marc 'BlackJack' Rintsch [mailto:[EMAIL PROTECTED]
Sent: Donnerstag, 20. März 2008 15:24
To: [email protected]
Subject: Re: Problem with PARAGRAPH SEPARATOR
On Thu, 20 Mar 2008 13:03:17 +, Dominique.Holzwarth wrote:
> The output of the transformation (a big string containg the whole
> file) contains a so called 'paragraph separator' (unicode: 2029). If I
> want to pring that string (file) to the std out or a file object then
> I get a "UnicodeError" saying that the unicode 2029 can't be encoded...
>
> Can anyone please tell me how I should handle that paragraph seperator?
You have to encode the unicode object in an encoding that know this character.
UTF-8 might be a candidate encoding for this.
Ciao,
Marc 'BlackJack' Rintsch
*
This e-mail and any files attached are strictly confidential, may be legally
privileged and are intended solely for the addressee. If you are not the
intended recipient please notify the sender immediately by return email and
then delete the e-mail and any attachments immediately. The views and or
opinions expressed in this e-mail are not necessarily the views of De La Rue
plc or any of its subsidiaries and the De La Rue Group of companies, their
directors, officers and employees make no representation about and accept no
liability for its accuracy or completeness. You should ensure that you have
adequate virus protection as the De La Rue Group of companies do not accept
liability for any viruses
De La Rue plc Registered No.3834125, De La Rue Holdings plc Registered No 58025
and De La Rue International Limited Registered No 720284 are all registered in
England with their registered office at: De La Rue House, Jays Close, Viables,
Hampshire RG22 4BS
--
http://mail.python.org/mailman/listinfo/python-list
Re: Reinstall python 2.3 on OSX 10.3.5?
0) compile and install GNU readline 5.0 with the usual ./configure method ftp://ftp.cwru.edu/pub/bash/readline-5.0.tar.gz 1) as an administrator, remove the contents of "/System/Library/Frameworks/Python.framework" 2) install Python from the standard distribution: ./configure --enable-framework=/System/Library/Frameworks make sudo make frameworkinstall 3) install the extras in /Applications if you want to: sudo make frameworkinstallextras Move them to /Developer/Applications/Utilities/MacPython-2.3 4) remove every python* from /usr/local/bin Those in /usr/bin/ are OK for Python 2.3 5) replace "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages" with a symbolic link to "/Library/Python/2.3". Name it "site-packages". I have installed and used Python 2.3.x this way without any problem whatsoever. -- http://mail.python.org/mailman/listinfo/python-list
importing module
Hi all Lets assume I have the following structure of directories and python modules: Root-dir |_dir1 |_ script1.py |_dir2 |_ script2.py |_sudir2 |_ script3.py Is it possible to import script1 into script2 and script3? Or do have to put script1.py into the Lib\site-packages folder of my Python installation so that it'll be in the standard module search path? Thx & greets Dominique * This e-mail and any files attached are strictly confidential, may be legally privileged and are intended solely for the addressee. If you are not the intended recipient please notify the sender immediately by return email and then delete the e-mail and any attachments immediately. The views and or opinions expressed in this e-mail are not necessarily the views of Talaris Holdings Limited or any of its subsidiaries and the Talaris Group of companies, their directors, officers and employees make no representation about and accept no liability for its accuracy or completeness. You should ensure that you have adequate virus protection as the Talaris Group of companies do not accept liability for any viruses. Talaris Holdings Limited Registered No. 6569609 and Talaris Limited Registered No 6569621 are both registered in England with their registered office at: Talaris House, Crockford Lane, Chineham Business Park, Basingstoke, RG24 8QZ * -- http://mail.python.org/mailman/listinfo/python-list
