[Twisted-web] Error in my first test...
Matt Goodall
matt at pollenation.net
Thu Aug 19 02:57:51 MDT 2004
On Thu, 2004-08-19 at 08:03, Alessandro Barchi wrote:
> Hi
>
> I try to write a very simple example
> with nevow.
>
> but I have this error, where I wrong?
>
> It seems that I cannot load the file alextest.py
> but the file exists!
>
> Thanks!!
>
> alex at mail:~/src/python/tests/nevow_samples/mysample0$ twistd -noy runapp.tac
> 2004/08/19 08:47 CEST [-] Log opened.
> 2004/08/19 08:47 CEST [-] twistd 1.3.0rc1 (/usr/bin/python2.3 2.3.4)
> starting up
> 2004/08/19 08:47 CEST [-] reactor class:
> twisted.internet.default.SelectReactor
> 2004/08/19 08:47 CEST [-] Loading runapp.tac...
> 2004/08/19 08:47 CEST [-] Traceback (most recent call last):
> 2004/08/19 08:47 CEST [-] File
> "/usr/lib/python2.3/site-packages/twisted/application/app.py", line 118, in
> getApplication
> 2004/08/19 08:47 CEST [-] application =
> service.loadApplication(filename, style, passphrase)
> 2004/08/19 08:47 CEST [-] File
> "/usr/lib/python2.3/site-packages/twisted/application/service.py", line 319,
> in loadApplication
> 2004/08/19 08:47 CEST [-] application = sob.loadValueFromFile(filename,
> 'application', passphrase)
> 2004/08/19 08:47 CEST [-] File
> "/usr/lib/python2.3/site-packages/twisted/persisted/sob.py", line 213, in
> loadValueFromFile
> 2004/08/19 08:47 CEST [-] exec data in d, d
> 2004/08/19 08:47 CEST [-] File "<string>", line 1
> 2004/08/19 08:47 CEST [-] import alextest
> 2004/08/19 08:47 CEST [-] ^
> 2004/08/19 08:47 CEST [-] SyntaxError: invalid syntax
> 2004/08/19 08:47 CEST [-] Failed to load application: invalid syntax (line
> 1)
> 2004/08/19 08:47 CEST [-] Traceback (most recent call last):
> File "/usr/bin/twistd", line 36, in ?
> run()
> File "/usr/lib/python2.3/site-packages/twisted/scripts/twistd.py",
> line 184, in run
> app.run(runApp, ServerOptions)
> File
> "/usr/lib/python2.3/site-packages/twisted/application/app.py", line 205, in
> run
> runApp(config)
> File "/usr/lib/python2.3/site-packages/twisted/scripts/twistd.py",
> line 174, in runApp
> application = app.getApplication(config, passphrase)
> --- <exception caught here> ---
> File
> "/usr/lib/python2.3/site-packages/twisted/application/app.py", line 118, in
> getApplication
> application = service.loadApplication(filename, style,
> passphrase)
> File
> "/usr/lib/python2.3/site-packages/twisted/application/service.py", line 319,
> in loadApplication
> application = sob.loadValueFromFile(filename, 'application',
> passphrase)
> File "/usr/lib/python2.3/site-packages/twisted/persisted/sob.py",
> line 213, in loadValueFromFile
> exec data in d, d
> exceptions.SyntaxError: invalid syntax (line 1)
>
>
> Failed to load application: invalid syntax (line 1)
> 2004/08/19 08:47 CEST [-]
If twisted's sob.py is one of the last modules in the traceback then the
problem is almost certainly in the .tac file. In this case, the error is
a syntax error on line 1 of the .tac file.
I suspect that you have a DOS vs UNIX line ending problem. Have you
copied the file from DOS to UNIX (or vice versa) without fixing the line
endings? It looks like you're on a Linux box so "file runapp.tac" will
probably report that you have CRLF line endings. If so, use flip (or
similar tool) to change the line endings and try it all again.
Hope this helps.
Cheers, Matt
--
Matt Goodall <matt at pollenation.net>
More information about the Twisted-web
mailing list