[issue25144] 3.5 Win install fails with "TARGETDIR"

2015-12-11 Thread Ivan Radic

Ivan Radic added the comment:

I got this with 3.5.1 installer on Windows 7. I solved it by running installer 
with elevated privileges. Installer for 2.7.11 was not affected.

--
nosy: +ivan.radic

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25144>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19642] shutil to support equivalent of: rm -f /dir/*

2013-11-18 Thread Ivan Radic

New submission from Ivan Radic:

Shutil supports deleting of files and directories but it offers no way to 
delete directory content (without deleting directory itself). Shell programming 
includes a lot of rm -rf /dir and rm -f /dir/*, and there is no direct 
equivalent of these commands in Python. Educate me if I am wrong on this claim.

Sure, I can write a quick for loop, and delete each subfile and subdirectory 
manually, but adding such ability to shutil would greatly enhance readability 
and simplicity of Python file handling scripts.

Implementation could be as simply as :
import os
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))

(example taken from http://docs.python.org/2/library/os.html#os.walk)

--
components: IO
messages: 203283
nosy: ivan.radic
priority: normal
severity: normal
status: open
title: shutil to support equivalent of: rm -f /dir/*
type: enhancement
versions: Python 2.7, Python 3.5

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19642
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19643] shutil rmtree fails on readonly files in Windows

2013-11-18 Thread Ivan Radic

New submission from Ivan Radic:

shutil.rmtree works nice on Windows until it hits file with read only attribute 
set. Workaround is to provide a onerror parameter as a function that checks and 
removes file attribute before attempting to delete it. Can option to delete 
read_only files be integrated in shutil.rmtree?

Example output in In Python 2.7:
shutil.rmtree(C:\\2)

Traceback (most recent call last):
  File pyshell#60, line 1, in module
shutil.rmtree(C:\\2)
  File C:\Program Files (x86)\Python.2.7.3\lib\shutil.py, line 250, in rmtree
onerror(os.remove, fullname, sys.exc_info())
  File C:\Program Files (x86)\Python.2.7.3\lib\shutil.py, line 248, in rmtree
os.remove(fullname)
WindowsError: [Error 5] Access is denied: 'C:\\2\\read_only_file.txt'

Example output in In Python 3.3:
shutil.rmtree(C:\\2)
Traceback (most recent call last):
  File pyshell#1, line 1, in module
shutil.rmtree(C:\\2)
  File C:\Program Files (x86)\Python.3.3.0\lib\shutil.py, line 460, in rmtree
return _rmtree_unsafe(path, onerror)
  File C:\Program Files (x86)\Python.3.3.0\lib\shutil.py, line 367, in 
_rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
  File C:\Program Files (x86)\Python.3.3.0\lib\shutil.py, line 365, in 
_rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\2\\read_only_file.txt'

--
components: IO
messages: 203285
nosy: ivan.radic
priority: normal
severity: normal
status: open
title: shutil rmtree fails on readonly files in Windows
type: behavior
versions: Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19643
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19643] shutil rmtree fails on readonly files in Windows

2013-11-18 Thread Ivan Radic

Ivan Radic added the comment:

You are essentially asking that we have an option to make the windows behavior 
mirror the posix behavior?  (A read only file in a writable directory can be 
deleted in posix, since only the directory entry, not the file, is being 
deleted.)

Actually, your explanation is perfect.
I want to be able to remove some directory after I am done using it. When 
similar operation is done through file manager, dialog pops up asking for 
confirmation, I would like to have function parameter equivalent of yes to 
all dialog that file manager gives me.

The thing is, anyone working with files is used to think in rm -rf kind of 
way, and on Windows read_only files break this workflow. I discovered this 
problem few days ago when I was working on custom backup script that needs to 
work both on Linux (at home) and Windows (at work). Currently, I need to have 
some extra *windows only* code just to be able to successfully remove a 
directory.

Quick Google search discovered the workaround 
(http://stackoverflow.com/questions/1889597/deleting-directory-in-python), so I 
am set, but the original 
question: Why oh why is this such a pain?
and the comment: Maybe nobody has taken the five minutes to file a bug at 
bugs.python.org 
resonated in my head long enough to give it a try.

For me it makes sense to have this option configurable. And it make a ton of 
sense to support one line equivalent of rm -rf.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19643
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com