email2trac

36 views
Skip to first unread message

Frank R.

unread,
Jun 20, 2023, 10:39:07 AM6/20/23
to trac-...@googlegroups.com
I just succeeded updating a server from Ubuntu 16.04 to 18.04 and Trac from 1.0 to 1.4.. Everything seems to work fine, but email2trac. I checked passing a mail file on command line to it, it returns without errors, but no new ticke in Trac.

Does anyone recognize that behaviour after updating to 1.4.? Suggestions are welcome.

Regards
Frank

Jun Omae

unread,
Jun 20, 2023, 11:08:56 AM6/20/23
to trac-...@googlegroups.com
email2trac 2.14.0 and early doesn't support Trac 1.4.
Instead, try master branch of the following repository:

https://gitlab.com/surfsara/email2trac
https://gitlab.com/surfsara/email2trac/-/merge_requests/10
https://gitlab.com/surfsara/email2trac/-/commit/e74da21eee3c9d83b9a5a3a0008aee97f3fbf9e0

--
Jun Omae <jun...@gmail.com> (大前 潤)

Frank R.

unread,
Jun 23, 2023, 4:21:59 AM6/23/23
to trac-...@googlegroups.com
Thanks a lot, that works!

--
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 trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAEVLMah8CfJoOwmrOnvrDaC%2BRAWTJm1QYU68qPG%2Brs3K4X%2B1fw%40mail.gmail.com.

Frank R.

unread,
Jul 12, 2023, 7:31:30 AM7/12/23
to trac-...@googlegroups.com
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

Jun Omae

unread,
Jul 12, 2023, 9:52:47 AM7/12/23
to trac-...@googlegroups.com
I'd suggest reporting it to email2trac's issue tracker [1].

[1] https://gitlab.com/surfsara/email2trac/-/issues/new

Dan

unread,
Jul 12, 2023, 10:53:39 AM7/12/23
to Trac Users
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:


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


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.

Jun Omae

unread,
Jul 12, 2023, 6:52:09 PM7/12/23
to trac-...@googlegroups.com
On 2023/07/12 20:31, Frank R. wrote:
> 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)

Try the following patch:

--- email2trac.orig 2023-07-13 07:43:25.588875000 +0900
+++ email2trac 2023-07-13 07:46:07.313533000 +0900
@@ -617,7 +617,10 @@
fx = os.fdopen(fd, 'wb')

self.logger.debug('saving email to %s' %(tmp_file))
- fx.write(('%s' % message).encode())
+ data = '%s' % message
+ if isinstance(data, unicode):
+ data = data.encode('utf-8')
+ fx.write(data)
fx.close()

try:

Frank R.

unread,
Jul 17, 2023, 8:44:05 AM7/17/23
to trac-...@googlegroups.com
Thanks to everyone! I guess I won't be able to go on with your suggestions before end of August (other projects, vacations).

Have a good time!
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 trac-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages