Comment 3 for bug 731803

Revision history for this message
jorgen jorgensen (gardsted-gmail) wrote : Re: [Bug 731803] Re: WindowsError when renaming temporary file

I will, though I am convinced it works if just os.close(the handle) is
there and it works on other platforms.

I must first find out how to get the correct source

Is there a way to easy_install the trunk into a virtualenv directly or
should I get it first via svn?git or what is holding it?

Never mind that question, I'll find out.
Just in the process of drinking a beer (red horse, 1 ltr) - so it may
take some time.
On vacation in the phillipines

I am very excited about pyramid+chameleon.
I have been using cherrypy+simpletal up until now, so I am pleased
that chameleon (and tal) is built in, including the ability to take
the curly braces shortcut where applicable.

On Mon, Mar 14, 2011 at 4:33 PM, Malthe Borch
<email address hidden> wrote:
> I have reworked the loader somewhat, to an effect which should be the
> same as your patch. Can you try it out?
>
> Thanks!
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/731803
>
> Title:
>  WindowsError when renaming temporary file
>
> Status in Attribute language template compiler:
>  New
>
> Bug description:
>  Following the tutorial pyramid-1.0.pdf, paragraph 5.6 on win XP I get the following at localhost:6543
>  I am not sure whether the bug belongs here or over at pyramid, so bear with me.
>
>  I worked around the following problem by inserting the line:
>              os.close(fd)
>  just after the line:
>              fd, fn = tempfile.mkstemp(prefix=base, suffix='.tmp', dir=self.path)
>  In the file builder.py inside ModuleLoader.build
>
>
>  Module pyramid.chameleon_zpt:52 in __call__         view
>  <<          except (TypeError, ValueError):
>                     raise ValueError('renderer was passed non-dictionary as value')
>                 result = self.template(**system)
>                 return result
>  >>  result = self.template(**system)
>  Module chameleon.template:121 in __call__         view
>  <<      def __call__(self, **kwargs):
>                 return self.render(**kwargs)
>
>             def __repr__(self):
>  >>  return self.render(**kwargs)
>  Module chameleon.zpt.template:96 in render         view
>  <<          setdefault("nothing", None)
>
>                 return super(PageTemplate, self).render(**kwargs)
>
>             def include(self, stream, econtext, rcontext):
>  >>  return super(PageTemplate, self).render(**kwargs)
>  Module chameleon.template:153 in render         view
>  <<          stream = self.output_stream_factory()
>                 econtext = rcontext.pop('econtext', False) or Scope(rcontext)
>                 self.cook_check()
>                 try:
>                     self._render(stream, econtext, rcontext)
>  >>  self.cook_check()
>  Module chameleon.template:260 in cook_check         view
>  <<          if self._cooked is False:
>                     body = self.read()
>                     self.cook(body)
>
>             def detect_encoding(self, body):
>  >>  self.cook(body)
>  Module chameleon.template:134 in cook         view
>  <<      def cook(self, body):
>                 digest = self._digest(body)
>                 program = self._cook(body, digest)
>
>                 for name, function in program.items():
>  >>  program = self._cook(body, digest)
>  Module chameleon.template:333 in _cook         view
>  <<                      source = "# filename: %s\n#\n%s" % (self.filename, source)
>
>                         cooked = self.loader.build(source, name)
>                     except TemplateError:
>                         exc = sys.exc_info()[1]
>  >>  cooked = self.loader.build(source, name)
>  Module chameleon.loader:112 in build         view
>  <<                  raise
>
>                     os.rename(fn, name)
>                     log.debug("compiling %s into byte-code..." % filename)
>                     py_compile.compile(name)
>  >>  os.rename(fn, name)
>
>  and furthermore (in the console)
>
>  Traceback (most recent call last):
>    File "C:\Python27\Lib\atexit.py", line 24, in _run_exitfuncs
>      func(*targs, **kargs)
>    File "D:\Users\Rendon\servage\pd\lib\site-packages\chameleon-2.0_rc5-py2.7.egg
>  \chameleon\template.py", line 84, in cleanup
>      shutil.rmtree(path)
>    File "C:\Python27\Lib\shutil.py", line 249, in rmtree
>      onerror(os.remove, fullname, sys.exc_info())
>    File "C:\Python27\Lib\shutil.py", line 247, in rmtree
>      os.remove(fullname)
>  WindowsError: [Error 32] The process cannot access the file because it is being
>  used by another process: 'c:\\docume~1\\user\\locals~1\\temp\\tmpwxeqh6\\mytempl
>  ate_8612ea41c3c22dac09c97155d2364cf65886b7007bajdn.tmp'
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/chameleon.core/+bug/731803/+subscribe
>

--
med venlig hilsen / with kind regards
Jørgen G. Jørgensen.
---