[ python-Bugs-1708538 ] TimedRotatingFileHandler's doRollover opens file in "w" mode

2007-04-28 Thread SourceForge.net
Bugs item #1708538, was opened at 2007-04-27 07:30
Message generated for change (Comment added) made by vsajip
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1708538&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Private: No
Submitted By: Florian Schmidt (fastflo)
Assigned to: Vinay Sajip (vsajip)
Summary: TimedRotatingFileHandler's doRollover opens file in "w" mode

Initial Comment:
if TimedRotatingFileHandler does an doRollover() it opens the new file 
hardcoded with mode "w" whilst the baseclass FileHandler opens it with mode "a" 
if nothing else is specified in the constructor. it should use the same default 
behavior as FileHandler and/or give a way to specify another open-mode.

if multiple processes write to the same file, and one does the RollOver all 
other newly spawned processes write to the end of the new file but the still 
running first process who did the rollover will write from the beginning of the 
file - overwriting log entries from the other procs...

--

>Comment By: Vinay Sajip (vsajip)
Date: 2007-04-28 12:50

Message:
Logged In: YES 
user_id=308438
Originator: NO

Since there is no interprocess synchronisation in Python, writing to the
same logging file from multiple processes is not supported. If you want
output from multiple processes to end up in the same file, have all your
processes send logging events to a SocketHandler, and set up a separate
socket receiver (which could be in one of the processes) to receive the
events and log to file. A working example is given here:

http://docs.python.org/lib/network-logging.html

Note that even if the system was changed to use 'a' rather than 'w', this
would not eliminate potential problems with e.g. data in unflushed buffers,
etc.

--

Comment By: Neal Norwitz (nnorwitz)
Date: 2007-04-28 01:40

Message:
Logged In: YES 
user_id=33168
Originator: NO

This sounds like a logging module issue.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1708538&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1709282 ] test_1686475 fails when pagefile.sys does not exist

2007-04-28 Thread SourceForge.net
Bugs item #1709282, was opened at 2007-04-28 10:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709282&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Calvin Spealman (ironfroggy)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_1686475 fails when pagefile.sys does not exist

Initial Comment:
In older versions of Windows I suppose the file is reliable, but apparently no 
longer. This patch fixes it, by creating a temporary file as a test fixture, 
instead of relying on an operating system file.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709282&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1709284 ] test_1686475 fails because pagefile.sys does not exist

2007-04-28 Thread SourceForge.net
Bugs item #1709284, was opened at 2007-04-28 10:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709284&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Calvin Spealman (ironfroggy)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_1686475 fails because pagefile.sys does not exist

Initial Comment:
The file pagefile.sys is used as a test on stat'ing an open file, because 
previously we could rely on windows using it. It does not exist in newer 
versions, so the test fails. The attached patch uses a temporary file instead.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709284&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1709282 ] test_1686475 fails when pagefile.sys does not exist

2007-04-28 Thread SourceForge.net
Bugs item #1709282, was opened at 2007-04-28 10:52
Message generated for change (Settings changed) made by ironfroggy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709282&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Platform-specific
Status: Open
>Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Calvin Spealman (ironfroggy)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_1686475 fails when pagefile.sys does not exist

Initial Comment:
In older versions of Windows I suppose the file is reliable, but apparently no 
longer. This patch fixes it, by creating a temporary file as a test fixture, 
instead of relying on an operating system file.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709282&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1709282 ] test_1686475 fails when pagefile.sys does not exist

2007-04-28 Thread SourceForge.net
Bugs item #1709282, was opened at 2007-04-28 10:52
Message generated for change (Settings changed) made by ironfroggy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709282&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Platform-specific
>Status: Deleted
Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Calvin Spealman (ironfroggy)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_1686475 fails when pagefile.sys does not exist

Initial Comment:
In older versions of Windows I suppose the file is reliable, but apparently no 
longer. This patch fixes it, by creating a temporary file as a test fixture, 
instead of relying on an operating system file.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709282&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1707255 ] lost global variables in main memory intensive execution

2007-04-28 Thread SourceForge.net
Bugs item #1707255, was opened at 2007-04-25 05:45
Message generated for change (Comment added) made by ironfroggy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1707255&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parser/Compiler
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Jordi Pujol Ahulló (jpahullo)
Assigned to: Nobody/Anonymous (nobody)
Summary: lost global variables in main memory intensive execution

Initial Comment:
Hello,

I was running a very main memory intensive program in my computer. I looked for 
similar bugs or troubles in the site and I didn't found any similar to this. I 
know that the use of global variables is not recommended by software 
engineering, but for special cases it is very fast to develop/test some ideas.

My problem statement is the following (very simplified and also attached):

## BEGINNING OF CODE
#test for globals

counter_1 = 0

def modifierfunction():
global counter_1

#some code
counter_1 += 1
#some other code

def test():
for i in range(2):
global counter_1
counter_1 = 0

for j in range(10):
modifierfunction()

print "COUNTER_1:", counter_1

def test2():
global counter_1
for i in range(2):
counter_1 = 0

for j in range(10):
modifierfunction()

print "COUNTER_1:", counter_1

if __name__ == "__main__":
test()
test2()
## END OF CODE

Globally speaking, it is a global variable, defined at the begining of the 
python file (counter_1), and it is modified in some functions within it (in 
this example, modifierfunction). At the end, it appear some tests that make 
what I need. 

If you try to run this code, it will always show the expected values in the 
standard out. But, let me to show you my problem.

In the beginning, I have the global statement as in test2. But I found that it 
only take a corrent value for the first iteration. The others it has always a 
zero value. I didn't understand anything.

Then, some collegue suggested me to change the place of the global statement 
(as in test()), and then it worked correctly, as it was expected.

I repeat. The above example works fine. But when this same structure, but with 
my big problem, very main memory intensive, test2() didn't work correctly.

Thank you for your attention.

Regards,

Jordi

--

Comment By: Calvin Spealman (ironfroggy)
Date: 2007-04-28 10:59

Message:
Logged In: YES 
user_id=112166
Originator: NO

If you really think there is a bug, don't post working code, post code
that actually demonstrates the problem. Something anyone else could use to
reproduce the bug.

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1707255&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1709284 ] test_1686475 fails because pagefile.sys does not exist

2007-04-28 Thread SourceForge.net
Bugs item #1709284, was opened at 2007-04-28 10:54
Message generated for change (Comment added) made by ironfroggy
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709284&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Platform-specific
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Calvin Spealman (ironfroggy)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_1686475 fails because pagefile.sys does not exist

Initial Comment:
The file pagefile.sys is used as a test on stat'ing an open file, because 
previously we could rely on windows using it. It does not exist in newer 
versions, so the test fails. The attached patch uses a temporary file instead.

--

>Comment By: Calvin Spealman (ironfroggy)
Date: 2007-04-28 14:32

Message:
Logged In: YES 
user_id=112166
Originator: YES

File Added: os_open_stat.patch

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1709284&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[ python-Bugs-1707768 ] os.path.normpath changes path (chops of trailing slash)

2007-04-28 Thread SourceForge.net
Bugs item #1707768, was opened at 2007-04-26 01:44
Message generated for change (Comment added) made by iszegedi
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1707768&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Robert Siemer (siemer)
Assigned to: Nobody/Anonymous (nobody)
Summary: os.path.normpath changes path (chops of trailing slash)

Initial Comment:
Hello everybody!

>>> os.path.normpath('/etc/passwd')
'/etc/passwd'


I don't know any environment at all where

a) '/etc/passwd/'
b) '/etc/passwd'

are treated the same. It clearly does not apply for the path part of http urls 
(this is left as an exercise for the reader).

But it also does not apply for (e.g.) Linux either:
an open() on path a) return ENOTDIR while it succeeds with b).

(assuming /etc/passwd is a file)

This is definitively not a documentation bug, as "normpath" should normalize a 
path and not fuck it up.


Robert

--

Comment By: Istvan Szegedi (iszegedi)
Date: 2007-04-28 22:27

Message:
Logged In: YES 
user_id=1772412
Originator: NO


Here is what Posix standard says about pathnames:

"Base Definitions volume of IEEE Std 1003.1-2001, Section 3.266,
Pathname.

A character string that is used to identify a file. In the context of IEEE
Std 1003.1-2001, a pathname consists of, at most, {PATH_MAX} bytes,
including the terminating null byte. It has an optional beginning slash,
followed by zero or more filenames separated by slashes. A pathname may
optionally contain one or more trailing slashes. Multiple successive
slashes are considered to be the same as one slash."

And in the details:

"A pathname that contains at least one non-slash character and that ends
with one or more trailing slashes shall be resolved as if a single dot
character ( '.' ) were appended to the pathname."

So if I am not mistaken, according to the POSIX standard the example that
you gave - '/etc/passwd/' - should be normalized to '/etc/passwd/.' That
does not happen, indeed.

The reason for that is that in posixpath.py file the normpath() function
is using a split('/') function to split up the path into smaller chunks,
skips everything which is empty or '.' and at the end of the normpath()
function it adds slash(es) only to the beginning of the string. 

As a test, I modified the normpath() function in the posixpath.py as
follows:

--- clip ---

def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
if path == '':
return '.'
initial_slashes = path.startswith('/')
# The next two lines were added by iszegedi
path = path.rstrip()
trailing_slash = path.endswith('/')
# POSIX allows one or two initial slashes, but treats three or more
# as single slash.
if (initial_slashes and
path.startswith('//') and not path.startswith('///')):
initial_slashes = 2
comps = path.split('/')
new_comps = []
for comp in comps:
if comp in ('', '.'):
continue
if (comp != '..' or (not initial_slashes and not new_comps) or
 (new_comps and new_comps[-1] == '..')):
new_comps.append(comp)
elif new_comps:
new_comps.pop()
comps = new_comps
path = '/'.join(comps)
if initial_slashes:
path = '/'*initial_slashes + path
# The next two lines were added by iszegedi
if trailing_slash:
path = path + '/.'
return path or '.'
  
-- clip --

So I added two lines (marked as "added by iszegedi" ) in the beginning to
remove any trailing whitespaces and check whether the path ends with slash.
Then at the end of the function I added another two lines to append '/.' to
the end of the return value if the input path variable ended by slash

This works now fine.

What makes it a bit tricky is that python os module imports different
xxxpath.py module depending on the host operating system. So it imports
different modules for nt, for mac, for os2, for posix, etc.  The solution
above works for posix, but the other modules need to be checked, to.


--

Comment By: Robert Siemer (siemer)
Date: 2007-04-26 01:47

Message:
Logged In: YES 
user_id=150699
Originator: YES

A bugreport bug:

The example should read os.path.normpath('/etc/passwd/')...

--

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1707768&group_id=5470
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com