Your file is specified in app.yaml as a static file; these files are not accessible by the application; they're uploaded to a completely different place from your application code, and are meant to only be served directly to your users' browsers, not accessed in your code. dev_appserver blocks access to them to mimic what you'd see on the production server.
If this file is not meant to ever be served directly to users, change app.yaml so it's no longer static. If you need to both serve it to users and access it in program code, you'll need 2 copies of it (or a symbolic link to it, although I'm not sure how this works on Windows), one of which is static and one of which isn't, probably in different directories. On Monday, October 1, 2012 8:20:50 AM UTC-4, Phát Trần wrote: > > I use > import os > print(os.path.getsize("abc.txt")) > Ane I got the log: > > WARNING 2012-10-01 12:16:13,943 dev_appserver_import_hook.py:595] > Blocking access to static file ".....\abc.txt" > ERROR 2012-10-01 12:16:13,944 wsgi.py:203] > Traceback (most recent call last): > File "C:\Program > Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 195, > in Handle > handler = _config_handle.add_wsgi_middleware(self._LoadHandler()) > File "C:\Program > Files\Google\google_appengine\google\appengine\runtime\wsgi.py", line 239, > in _LoadHandler > handler = __import__(path[0]) > File "C:\Program > Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", > > line 719, in Decorate > return func(self, *args, **kwargs) > File "C:\Program > Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", > > line 1923, in load_module > return self.FindAndLoadModule(submodule, fullname, search_path) > File "C:\Program > Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", > > line 719, in Decorate > return func(self, *args, **kwargs) > File "C:\Program > Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", > > line 1787, in FindAndLoadModule > description) > File "C:\Program > Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", > > line 719, in Decorate > return func(self, *args, **kwargs) > File "C:\Program > Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", > > line 1730, in LoadModuleRestricted > description) > File "D:\vangvn-igold\size.py", line 18, in <module> > print(os.path.getsize("abc.txt")) > File "C:\Python27\lib\genericpath.py", line 49, in getsize > return os.stat(filename).st_size > File "C:\Program > Files\Google\google_appengine\google\appengine\tools\dev_appserver_import_hook.py", > > line 663, in __call__ > raise OSError(errno.EACCES, 'path not accessible', path) > OSError: [Errno 13] path not accessible: 'abc.txt' > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-appengine/-/wQtq8th6tPgJ. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.