As a official response ... Jun is correct, of course.  Ignore what I say 
below if that works for you.

Unofficially, I'd say 'ascii' probably isn't the intended encoding, but 
that's just my guess.  Is the encode() function really using a default 
parameter for the encoding type?  That seems strange to me, though I admit 
I'm basically a casual Python programmer.  I have always used an explicit 
value for the encoding.

For instance, see here:

https://www.geeksforgeeks.org/how-to-fix-unicodeencodeerror-ascii-codec-cant-encode-character-uxa0-in-position-20-ordinal-not-in-range128-in-python/

I also found something about the version of Python ...

https://www.ibm.com/support/pages/execute-python-script-error-ascii-codec-cant-decode-byte-oxc3-position-2-orginal-not-range128

FWIW, I started learning Python just before Python 3 came out.  Once I 
learned there would be an incompatible change, I moved all our scripts to 
Python 3 and tried to avoid Python 2 like the plague.  So I don't know all 
that much Python 2 lore, though I have ported some code from 2 to 3, 
including the Bonjour library (but that was quite a while ago).

Are the versions of Python you're using in each case the same?  If not, 
maybe that's why your tests show different results than your production 
migration.  Or maybe the installations are using a different "default" 
encoding for some reason.  Or maybe that's all wrong and the data itself is 
different, but I'm assuming the problem is in parsing an incoming e-mail, 
and you're probably sending a very similar if not identical e-mail in each 
case.

Good Luck.

On Wednesday, July 12, 2023 at 6:31:30 AM UTC-5 Frank R. wrote:

> Hi,
>
> I hope it is ok to reanimate this thread, because...
>
> During the past 3 weeks I went through several complete Trac 1.0 --> 1.4. 
> upgrade processes, everytime I got email2trac (the most recent dev version) 
> to work flawlessly. Last Sunday I did the process on our production 
> machine... and testing email2trac I got the following error:
>
> Traceback (most recent call last):
>   File "/usr/local/bin/email2trac", line 2948, in <module>
>     tktparser.save_email_for_debug(m, settings.project_name)
>   File "/usr/local/bin/email2trac", line 620, in save_email_for_debug
>     fx.write(('%s' % message).encode())
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1424: 
> ordinal not in range(128)
>
> I had to reverse everything, because I did not find out why that happened... 
> the email2trac version running ist exactly the same as the one on my test 
> device, as is the python version....😭😡
>
> Any ideas?
>
> Thanks and regards
>
> Frank
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/546e16a2-85ea-4e21-890c-26d55485c46dn%40googlegroups.com.

Reply via email to