Trac[buildrequests] ERROR: Exception occured writing to file: [Errno 2] No such file or directory: 'buildrequests/json/breqs.json'
Traceback (most recent call last):
File "build\bdist.win32\egg\buildrequests\buildrequests.py", line 109, in process_request
file = open(breq_file, 'w')
IOError: [Errno 2] No such file or directory: 'buildrequests/json/breqs.json'
def get_templates_dirs(self):from pkg_resources import resource_filenamereturn [resource_filename(__name__, 'templates')]def get_htdocs_dirs(self):from pkg_resources import resource_filenamereturn [('buildrequests', resource_filename(__name__, 'htdocs'))]
Trac[buildrequests] ERROR: Exception occured writing to file: [Errno 2] No such file or directory: 'buildrequests\\json\x08reqs.json'
Traceback (most recent call last):
File "build\bdist.win32\egg\buildrequests\buildrequests.py", line 103, in process_request
file = open(breq_file, 'w')
IOError: [Errno 2] No such file or directory: 'buildrequests\\json\x08reqs.json'
> trac-users+unsubscribe@googlegroups.com.
> As a side-note I think it's poor design to write into htdocs, since this
> is meant to be served by web servers as static, cache-able content.
>
<OT?>
Exactly ! E.g. afaicr Graphviz plugin caches generated drawings due to
the fact that generating them is a time-consuming , resource intensive
task .
Thanks for the replies. I put the JSON file in htdocs as once it is written to it will be read from by a JQuery UI library that I am using (it needs to be stored in a file to allow for editing of the data). I see where you're coming from though so where would be best to put the file?
I’ve changed that and also was advised on stack overflow to change my data field to look like this:
data: JSON.stringify({method: "breq.getBreqs"})
My error message now reads as this:
Trac[json_rpc] ERROR: RPC(json) decode error
Traceback (most recent call last):
File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 148, in parse_rpc_request
data = json.load(req, cls=TracRpcJSONDecoder)
File "C:\Python27\Lib\json\__init__.py", line 278, in load
**kw)
File "C:\Python27\Lib\json\__init__.py", line 339, in loads
return cls(encoding=encoding, **kw).decode(s)
File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 99, in decode
obj = json.JSONDecoder.decode(self, obj, *args, **kwargs)
File "C:\Python27\Lib\json\decoder.py", line 369, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)
Trac[web_ui] ERROR: RPC(JSON-RPC) Error
Traceback (most recent call last):
File "build\bdist.win32\egg\tracrpc\web_ui.py", line 143, in _rpc_process
rpcreq = req.rpc = protocol.parse_rpc_request(req, content_type)
File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 162, in parse_rpc_request
raise JsonProtocolException(e, -32700)
JsonProtocolException: Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)
Trac[json_rpc] DEBUG: RPC(json) encoded response: {"error": {"message": "JsonProtocolException details : Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)", "code": -32700, "name": "JSONRPCError"}, "result": null, "id": null}
Trac[main] DEBUG: Dispatching <Request "GET '/chrome/common/trac_logo_mini.png'">
Trac[main] DEBUG: Dispatching <Request "POST '/jsonrpc'">
Trac[api] INFO: Synchronized '' repository in 0.00 seconds
Trac[web_ui] DEBUG: RPC incoming request of content type 'application/json' dispatched to <tracrpc.json_rpc.JsonRpcProtocol object at 0x06BD40D0>
Trac[web_ui] DEBUG: RPC(JSON-RPC) call by 'PaulWilding'
Trac[json_rpc] ERROR: RPC(json) decode error
Traceback (most recent call last):
File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 148, in parse_rpc_request
data = json.load(req, cls=TracRpcJSONDecoder)
File "C:\Python27\Lib\json\__init__.py", line 278, in load
**kw)
File "C:\Python27\Lib\json\__init__.py", line 339, in loads
return cls(encoding=encoding, **kw).decode(s)
File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 99, in decode
obj = json.JSONDecoder.decode(self, obj, *args, **kwargs)
File "C:\Python27\Lib\json\decoder.py", line 369, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)
Trac[web_ui] ERROR: RPC(JSON-RPC) Error
Traceback (most recent call last):
File "build\bdist.win32\egg\tracrpc\web_ui.py", line 143, in _rpc_process
rpcreq = req.rpc = protocol.parse_rpc_request(req, content_type)
File "build\bdist.win32\egg\tracrpc\json_rpc.py", line 162, in parse_rpc_request
raise JsonProtocolException(e, -32700)
JsonProtocolException: Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)
Trac[json_rpc] DEBUG: RPC(json) encoded response: {"error": {"message": "JsonProtocolException details : Extra data: line 1 column 1 - line 1 column 133 (char 1 - 133)", "code": -32700, "name": "JSONRPCError"}, "result": null, "id": null}
I’ve tried logging the request in parse_rpc_request in various ways but no output has been produced from this so I haven’t been able to inspect the request. I’ve used self.log.debug(str(req)), self.log.debug(json.load(req)) and self.log.debug(str(json.load(req))) to try to do this. I don’t know whether there’s another way to log this or if you have any idea of what the problem might be now?