[py-dev] patch to allow usage of py.lib within non-administrator account on windows
holger krekel
holger at merlinux.eu
Tue Jul 22 15:58:21 CEST 2008
Hi Harald!
thanks for the report. I think this got fixed in 0.9.1 -
are you using 0.9.0, maybe?
cheers,
holger
On Tue, Jul 22, 2008 at 12:15 +0200, Harald Armin Massa wrote:
> Hello!
>
> atm. py.lib uses
>
> os.tmpfile()
>
> within fdcapture.py.
>
>
> On windows os.tmpfile() tries to create the file within the root of
> c:\; and it is quite good practice to disallow write access to this
> directory for non-admin users (as this avoids killing crucial system
> files)
>
> So installation on windows using an user without write-access to c:\,
> even setup.py fails with "permission.denied"
>
> More info in:
>
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/4aa54e927f11bbc3?tvc=2
>
>
> It is fixable by using:
>
> def maketmpfile(self):
> """ create a temporary file
> """
> #~ f = os.tmpfile()
> f=tempfile.TemporaryFile()
> newf = py.io.dupfile(f)
> f.close()
> return newf
>
> def writeorg(self, str):
> """ write a string to the original file descriptor
> """
> tempfp = tempfile.TemporaryFile()
> try:
> os.dup2(self._savefd, tempfp.fileno())
> tempfp.write(str)
> finally:
> tempfp.close()
>
> within lines 42ff of py/io/fdcapture.py, of course after importing tempfile.
>
> I submit this patch into public domain.
>
> Harald
>
> --
> GHUM Harald Massa
> persuadere et programmare
> Harald Armin Massa
> Spielberger Straße 49
> 70435 Stuttgart
> 0173/9409607
> no fx, no carrier pidgeon
> -
> EuroPython 2008 will take place in Vilnius, Lithuania - Stay tuned!
> _______________________________________________
> py-dev mailing list
> py-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/py-dev
>
--
collaborative expert contracting: http://merlinux.eu
PyPy Python/Compiler tool chain: http://codespeak.net/pypy
pylib py.test/greenlets/svn APIs: http://pylib.org
More information about the Pytest-dev
mailing list