Possible problem with loading and installing compiled applications in web2py

100 views
Skip to first unread message

benjami...@gmail.com

unread,
Sep 11, 2017, 8:31:32 PM9/11/17
to web2py-users
Today I came across some unusual behaviour in web2py when I tried to install a compiled web2py application. Coming home I decided to see if I could replicate the same problem on my Mac (running macos Sierra) and found some equally unusual behaviour.

The problem can be easily demonstrated:

1. From the web2py website I downloaded the Mac version of web2py (for Normal Users) currently version 2.15.4-stable+timestamp.2017.09.02.04.02.22 (Running on Rocket 1.2.6, Python 2.7.3) 

2. From the web2py administrative interface I then compiled the ‘welcome’ application which is a standard application which comes with web2py

3. I then ‘Packed’ this newly created compiled version of the standard 'welcome' application

4. I then Uploaded and installed this newly created compiled application using a different name for the application

5. The original uncompiled ‘welcome’ application still works but the compiled version of the same application gives:

invalid view (default/index.html)

Obviously all of this is done on the same (i.e. one) machine with the same web2py version, Python etc and yet the compiled version will not work but the uncompiled version will. 

Am I missing something obvious?

Dave S

unread,
Sep 11, 2017, 9:01:34 PM9/11/17
to web2py-users

On Monday, September 11, 2017 at 5:31:32 PM UTC-7, benjami...@gmail.com wrote:
Today I came across some unusual behaviour in web2py when I tried to install a compiled web2py application. Coming home I decided to see if I could replicate the same problem on my Mac (running macos Sierra) and found some equally unusual behaviour.

The problem can be easily demonstrated:

[skipping to the end]

5. The original uncompiled ‘welcome’ application still works but the compiled version of the same application gives:

invalid view (default/index.html)

Obviously all of this is done on the same (i.e. one) machine with the same web2py version, Python etc and yet the compiled version will not work but the uncompiled version will. 

Am I missing something obvious?


My first thought is that a file got skipped in packaging.

In the new (or re-born) application , the newapp/views/default directory should include "index.html", and it seems that for some reason it doesn't.  If you copy that one file from "welcome" to "newapp", does it fix the app?

The packed version is just a zip file, AIUI, with a different extension.  If the file copy fixed the broken app, then it should be possible to see if the file made it into the zip.  If it did not, that suggests a packer problem.  If it did, perhaps an unpacking problem.

Dave
/dps

Anthony

unread,
Sep 11, 2017, 9:22:59 PM9/11/17
to web2py-users
Did you reload routes or restart the web server?

benjami...@gmail.com

unread,
Sep 13, 2017, 4:20:42 AM9/13/17
to web2py-users
Hi Dave

Firstly many thanks for your response. 

When I reviewed the files in the new (or 're-born') compiled 'Welcome' app both the view  (views.default.index.html.pyc) AND its associated controller (controllers.default.index.pyc) correctly exist in the 'compiled' folder. (Obviously no files exist - or indeed should exist for a compiled app - in the 'views' folder.)

From this it seems that while web2py packs the compiled version with the relevant files, there seems to be a more fundamental issue at play here (bearing in mind that - for the purposes of explaining this problem - I have specifically (and deliberately) used both the version of web2py taken directly from the download page and used the 'Welcome' application - which comes as standard with web2py -  which is known (and understood) to function correctly).

I'm a bit baffled to be honest ...

Cheers

benjami...@gmail.com

unread,
Sep 13, 2017, 4:45:44 AM9/13/17
to web2py-users
Hi Anthony

Many thanks for your response.

As I mentioned to Dave S above, I deliberately (and specifically) chose this example of downloading the MacOs version (for Normal Users) directly from the web2py website and compiling - and then reloading - the 'Welcome' application to demonstrate the problem as simply and clearly as I thought possible.

I therefore tried to - tautology alert! - exactly mimic what any standard user would expect to do and see what would happen. So I - deliberately - did not restart the web server or reload routes or anything else for that matter. (However, as it happens when I did restart the web server the problem still remained).

Anyway, I am still a bit puzzled!

Cheers

Anthony

unread,
Sep 13, 2017, 11:58:30 AM9/13/17
to web2py-users
OK, it's a bug. I have submitted a pull request to fix it: https://github.com/web2py/web2py/pull/1763.

For now, "Pack compiled" will not work because compiled views will not be executed in apps containing only compiled files. As a temporary workaround, you can compile an app and then pack the whole app (not just the compiled files). In that case, the compiled views will be executed, but the non-compiled views need to be present (the problem is that the code checks for the existence of the non-compiled view even though it will ultimately execute the compiled view).

Anthony

Ben N

unread,
Sep 13, 2017, 12:15:13 PM9/13/17
to web...@googlegroups.com
Many thanks Anthony

I really do appreciate your input (and efforts) and thank you for submitting a pull request to fix it.

Kind Regards

Ben

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/R7ie7_neg7E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages