#6622 closed defect (worksforme)
MissingSectionHeaderError: File contains no section headers
Reported by: | Owned by: | Jonas Borgström | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | general | Version: | devel |
Severity: | critical | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
after editing the trac.ini manually (on a windows machine) and saving as utf-8, the error listed below occoured (taken from apache log).
Saving the file locally as ANSI, and copying to the server makes it work again, without visibility of the utf-8 stuff.
adding utf-8 stuff from the webadmin works without problem, and system runs fine again.
[Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/usr/lib64/python2.5/site-packages/mod_python/apache.py", line 299, in HandlerDispatch\n result = object(req) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/web/modpython_frontend.py", line 120, in handler\n gateway.run(dispatch_request) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/web/wsgi.py", line 87, in run\n response = application(self.environ, self._start_response) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/web/main.py", line 376, in dispatch_request\n env = open_environment(env_path, use_cache=not run_once) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/env.py", line 558, in open_environment\n env = env_cache.setdefault(env_path, open_environment(env_path)) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/env.py", line 562, in open_environment\n env = Environment(env_path) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/env.py", line 171, in __init__\n self.setup_config(load_defaults=create) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/env.py", line 327, in setup_config\n self.config = Configuration(os.path.join(self.path, 'conf', 'trac.ini')) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/config.py", line 46, in __init__\n self.parse_if_needed() [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/src/infra/trac/trac/config.py", line 212, in parse_if_needed\n self.parser.read(self.filename) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/usr/lib64/python2.5/ConfigParser.py", line 267, in read\n self._read(fp, filename) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: File "/usr/lib64/python2.5/ConfigParser.py", line 462, in _read\n raise MissingSectionHeaderError(fpname, lineno, line) [Wed Jan 09 17:15:42 2008] [error] [client 74.6.25.206] PythonHandler trac.web.modpython_frontend: MissingSectionHeaderError: File contains no section headers.\nfile: /var/www/vhosts/lazaridis.com/subdomains/intra/var/sxedio/conf/trac.ini, line: 1\n'\\xef\\xbb\\xbf# -*- coding: utf-8 -*-\\n'
Attachments (0)
Change History (9)
follow-up: 3 comment:2 by , 17 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
follow-up: 4 comment:3 by , 17 years ago
Replying to eblot:
![…]
That's a real issue, and it comes from Windows (once again):
The edited file contains an infamous "bom" UTF-8 marker.
Remove the 3 first bytes in your
trac.ini
or configure your editor not to add the BOM marker at the top of the file when you save UTF-8 encoded files.BOM markers are used on Windows (mostly) so that (stupid) tools can detect a file is coded with UTF-8.
![…]
BOM marker seem to be a Unicode Standard, independent of Windows.
Adding the sequence at the beginning of a utf-8 file seems to be standard-compliant, as there is no high-level protocoll which forbids the usage.
Thus, it looks that trac should tolerate the existence of the "EF BB BF" (utf-8 byte-order-mark) to detect UTF-8. It's not much effort anyway.
follow-up: 5 comment:4 by , 17 years ago
Replying to ilias@lazaridis.com:
Replying to eblot:
BOM marker seem to be a Unicode Standard, independent of Windows.
Not really independent: it's included in the Unicode Standard, but only used with Windows AFAICT. For example, a UTF-8 python file with a BOM marker is likely to fail to start on a Un*x box.
Anyway, it is known to cause issues and from Unicode Standard 5.0, section 3.10, “Unicode Encoding Schemes":
Its usage at the beginning of a UTF-8 data stream is neither required nor recommended by the Unicode Standard
It would be better if Trac could ignore this marker, but it does not seem to be a Trac issue but a standard Python library one. I don't think it is worth the trouble to provide a workaround for it in Trac.
comment:5 by , 17 years ago
Replying to eblot:
Replying to ilias@lazaridis.com:
Replying to eblot:
BOM marker seem to be a Unicode Standard, independent of Windows.
Not really independent: it's included in the Unicode Standard, but only used with Windows AFAICT. For example, a UTF-8 python file with a BOM marker is likely to fail to start on a Un*x box.
ok, but the case here is a trac.ini file
Anyway, it is known to cause issues and from Unicode Standard 5.0, section 3.10, “Unicode Encoding Schemes":
Its usage at the beginning of a UTF-8 data stream is neither required nor recommended by the Unicode Standard
reading standards is a desaster. The main two things are:
- The standard does not forbid the usage.
- Millions of editors add this marker by default.
It would be better if Trac could ignore this marker, but it does not seem to be a Trac issue but a standard Python library one. I don't think it is worth the trouble to provide a workaround for it in Trac.
I understand your thought.
On the other side, think about utf-8 users on windows (or which manage their remote unix box with a local windows machine). They will hit on a hidden error: Trac does not startup, and it needs log-inspection to get clarity. This can become very inconvenient.
anyway, it's your decision. Thanks for the clarifications.
follow-up: 7 comment:6 by , 17 years ago
This is a moot discussion at this point. Trac uses the normal Python ini parser, so if you have an issue with it I suggest you open a bug with Python itself. I think its fair to say we have no interest in making our own ini parser to fix something like this.
comment:7 by , 17 years ago
Replying to nkantrowitz:
This is a moot discussion at this point. Trac uses the normal Python ini parser, so if you have an issue with it I suggest you open a bug with Python itself. I think its fair to say we have no interest in making our own ini parser to fix something like this.
Well, I think the trac user can rate this ('your' interest).
comment:8 by , 16 years ago
Glad I found this ticket,
I just ran into this error after editing the trac.ini on a remote windows machine with microsoft notepad and no backup made from trac.ini :-)
Client: Vista Server: Server 2k3
I never had this error before because I always used scite or the local notepad on the server itself.
Here is an easy way to fix the ini again: Open Scite → Load the file → Mark all → Select File/Encoding (here you have beside others "UTF8 with BOM" and UTF8". Select "UTF8" and save the file.
comment:9 by , 15 years ago
Priority: | normal → high |
---|---|
Severity: | major → critical |
hi. friends I'm program Engineer in Korea and i've grammar problems to speak.
I had this case yesterday. I thought that is encoding problem too.
but i didn't edit 'trac.ini' … that's mistery… only edit the tickets Report query through Internet Browser.
Anyway it solved it by saving as ANSI. don't save as UTF-8.
i love man~ shoot! thanks.
comment:10 by , 15 years ago
another solution is
remove all event_viewer's logs.
i don't know why this works.. >.<
Replying to nkantrowitz:
That's a real issue, and it comes from Windows (once again):
The edited file contains an infamous "bom" UTF-8 marker.
Remove the 3 first bytes in your
trac.ini
or configure your editor not to add the BOM marker at the top of the file when you save UTF-8 encoded files.BOM markers are used on Windows (mostly) so that (stupid) tools can detect a file is coded with UTF-8.
ps: Noah, do not delete this ticket it might be useful for other people.