Broken app IOError: [Errno 13] Permission denied

469 views
Skip to first unread message

Fran

unread,
Jan 18, 2010, 6:16:33 PM1/18/10
to web2py-users
Traceback (most recent call last):
File "C:\Bin\web2py\gluon\main.py", line 478, in wsgibase
serve_controller(request, response, session)
File "C:\Bin\web2py\gluon\main.py", line 193, in serve_controller
page = run_controller_in(request.controller, request.function,
environment)
File "C:\Bin\web2py\gluon\compileapp.py", line 412, in
run_controller_in
fp = open(filename, 'r')
IOError: [Errno 13] Permission denied: 'C:\\Bin\\web2py\\applications\
\sahana/controllers/default.py'


Why would my app suddenly break on me?

Happens with no model, happens despite having wiped cache, databases,
errors, sessions & restarted

Other applications are fine, so the web2py install is fine...

F

mdipierro

unread,
Jan 18, 2010, 6:41:02 PM1/18/10
to web2py-users
what triggered the change in behavior?

The app does not have permission to open the controller file.

Open python and try:

open('C:\\Bin\\web2py\\applications\\sahana/controllers/
default.py','r')

does it work? Is the path right?

Massimo

Fran

unread,
Jan 18, 2010, 7:31:29 PM1/18/10
to web2py-users
On Jan 18, 11:41 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> what triggered the change in behavior?

I really don't know!

> The app does not have permission to open the controller file.
> Open python and try:
> open('C:\\Bin\\web2py\\applications\\sahana/controllers/
> default.py','r')
> does it work? Is the path right?

Seems to:
In [2]: open('C:\\Bin\\web2py\\applications\\sahana/controllers/
default.py','r')
Out[2]: <open file 'C:\Bin\web2py\applications\sahana/controllers/
default.py', m
ode 'r' at 0x0253EF08>

That's from a Python shell in the app too...so model loads completely
without error.

Stumped...

F

mdipierro

unread,
Jan 18, 2010, 8:35:59 PM1/18/10
to web2py-users
So your models read but the controller no? Is this reproducible or an
occasional error?

Does welcome works fine?

Massimo

Fran

unread,
Jan 19, 2010, 3:41:54 AM1/19/10
to web2py-users
On Jan 19, 1:35 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> So your models read but the controller no? Is this reproducible or an
> occasional error?

100% repro :/

> Does welcome works fine?

Yes, other apps are fine...

F

mdipierro

unread,
Jan 19, 2010, 8:11:41 AM1/19/10
to web2py-users
I do not know. One of the models(or modules imported by the models) is
doing something is should not do, for example:
1) redefined open
2) call chdir
3) alter sys.path
4) call a not-thread safe module

Fran

unread,
Jan 19, 2010, 9:35:27 AM1/19/10
to web2py-users
On Jan 19, 1:11 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I do not know. One of the models(or modules imported by the models) is
> doing something is should not do, for example:
> 1) redefined open
> 2) call chdir
> 3) alter sys.path
> 4) call a not-thread safe module

All seem like valid ideas, however the problem happens even when there
are no models!

What happens before/after model execution but which is within
application?
- happens with all controllers...invalid controller names still give
'invalid request' so web2py can see that the controller file exists...

F

mdipierro

unread,
Jan 19, 2010, 9:46:08 AM1/19/10
to web2py-users
No app level code is executed before a call to controllers.

I suggest

cd applications
mkdir sahanatest
cp -r sahana/* sahanatest
rm -r sahanatest/models
echo 'def index(): return dict()' > sahanatest/controllers/test.py
wget http://.../sahanatest/test/index

Do you get the error?

Fran

unread,
Jan 19, 2010, 10:17:18 AM1/19/10
to web2py-users
On Jan 19, 2:46 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> No app level code is executed before a call to controllers.
> I suggest
>    cd applications
>    mkdir sahanatest
>    cp -r sahana/* sahanatest
>    rm -r sahanatest/models
>    echo 'def index(): return dict()' > sahanatest/controllers/test.py
>    wgethttp://.../sahanatest/test/index

> Do you get the error?

No, not even with the model & with custom views code.

After some more experimentation, I found that I needed to amend the
text encoding of the files & copy/paste into new files.....doesn't
seem like the end result matters, just the amending...default.py
fixed, still struggling with the rest.

Not sure why this would suddenly have happened!

Very bizaarre...

Thanks for your help in narrowing it down anyway :)

F

mdipierro

unread,
Jan 19, 2010, 12:57:28 PM1/19/10
to web2py-users
Somebody must have put some unicode string somewhere.

Georg Hildebrand

unread,
Feb 12, 2014, 9:47:56 AM2/12/14
to web...@googlegroups.com
I recently came across this issue to when using wsgi mod. The simple think i needed to do was adding the full root folder to the session path.
like:
session = web.session.Session(app, web.session.DiskStore('%s/sessions'%global_variables.ROOT), {'count': 0})
Reply all
Reply to author
Forward
0 new messages