[Twisted-web] [resent.. patch fixed] liveevil.py import breaks
py2exe
Cory Dodt
corydodt at twistedmatrix.com
Wed Mar 16 17:55:35 MST 2005
Cory Dodt wrote:
> The following patch is the quickest hack I could think of to make liveevil
> import successfully (albeit non-usefully) in an app that bundles nevow with
> py2exe.
>
> Liveevil won't *work* under these conditions, so someone needs to think
> of a
> way to tell it how to find liveevil.js if they want py2exe + liveevil.
> This
> should permit non-liveevil nevow apps work ok though, which currently they
> don't. Without this patch you get an error along the lines of IOError: No
> such file "C:\...\library.zip\nevow\liveevil.js".
>
> C
>
Index: liveevil.py
===================================================================
--- liveevil.py (revision 1334)
+++ liveevil.py (working copy)
@@ -294,16 +294,20 @@
return os.path.join(dirname, 'liveevil.js')
-_glueJS = _locateGlueJS()
+try:
+ _glueJS = _locateGlueJS()
-# A static.File resource that can be used from a <link>
-glueJS = static.File(_glueJS, 'text/javascript')
+ # A static.File resource that can be used from a <link>
+ glueJS = static.File(_glueJS, 'text/javascript')
-# Inline JavaScript glue. TODO: deprecate this.
-glue = tags.inlineJS(open(_glueJS).read())
+ # Inline JavaScript glue. TODO: deprecate this.
+ glue = tags.inlineJS(open(_glueJS).read())
-# Glue which tells livepage to only allow clientToServer events, not async
serverToClient events
-inputOnlyGlue = tags.inlineJS("var auto_open = false; var liveevil_unload =
true;\n" + ''.join(open(_glueJS).readlines()[1:]))
+ # Glue which tells livepage to only allow clientToServer events, not
async serverToClient events
+ inputOnlyGlue = tags.inlineJS("var auto_open = false; var liveevil_unload
= true;\n" + ''.join(open(_glueJS).readlines()[1:]))
+except EnvironmentError:
+ glueJS = inputOnlyGlue = glue = None
+ warnings.warn("Could not open liveevil.js")
ctsTemplate = "nevow_clientToServerEvent('%s',this%s);%s"
More information about the Twisted-web
mailing list