Am 17.07.2012 18:45, wrote paul.wilding: > I'm trying to write a json serialization of data to a json file > stored in my plugin directory. The plugin is called buildrequests and > the file is found at > buildrequestsplugin\buildrequestsplugin\buildrequests\htdocs\json
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. > The error message written to the log is: > > 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' > > > where breq_file is 'buildrequests/json/breqs.json'. > > The same occurs if the breq_file is changed to > 'buildrequests/htdocs/breqs.json'. 'buildrequests' is defined as the > directory to reference to my htdocs and works for my javascript and > css files and I have a reference in package_data in setup.py to > 'htdocs/json/*' and so I'm running out of ideas - the only thing I > can think of is that it might work if I were to move the file outside > the main plugin directory i.e. outside the egg? Did you implement both methods of the ITemplateProvider? This is required to reference files from the egg within you Trac plugin code. Yours, Steffen Hoffmann [1] http://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.web.chrome.ITemplateProvider
smime.p7s
Description: S/MIME Cryptographic Signature
