[issue36800] Invalid coding error hidden on Windows

2019-05-06 Thread Yuval Greenfield


Yuval Greenfield  added the comment:

Replacing `utf8` with `utf-8` is the best workaround in my situation. Using the 
`utf8` alias is required to reproduce the issue based on my testing and the 
cited issue (https://bugs.python.org/issue20844).

Thank you for the reference.

--

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



[issue36800] Invalid coding error hidden on Windows

2019-05-05 Thread Yuval Greenfield


Yuval Greenfield  added the comment:

Note I am aware the actual problem is "utf8" vs "utf-8". But for some reason on 
Windows the exception does not reflect that.

--

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



[issue36800] Invalid coding error hidden on Windows

2019-05-05 Thread Yuval Greenfield


New submission from Yuval Greenfield :

These lines fail on Windows in a surprising way:

# -*- coding: utf8 -*-
import threading
print("threading %s" % threading)


Normally they would throw this:

  ```File 
"C:\Python36\Lib\site-packages\missinglink_kernel\callback\log_monitor.py", 
line 1
SyntaxError: encoding problem: utf8```

But attached is a file that throws this instead:

```
Traceback (most recent call last):
  File 
"C:\Python36\Lib\site-packages\missinglink_kernel\callback\log_monitor.py", 
line 2, in 
import threading
NameError: name 'threading' is not defined
```

It seems that the amount of lines in the file will cause the exception hiding 
bug to manifest.

This issue did reproduce on my Windows machine here:

* Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit 
(AMD64)] on win32
* Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: 
Anaconda, Inc. on win32
* Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit 
(Intel)] on win32

It did NOT reproduce on my Mac at all:

It does not repro on my mac at all:
* Python 3.7.1 (default, Dec 14 2018, 13:28:58)  [Clang 4.0.1 
(tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
* Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37) [GCC 4.2.1 
Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

--
components: Windows
files: log_monitor.py
messages: 341420
nosy: paul.moore, steve.dower, tim.golden, ubershmekel, zach.ware
priority: normal
severity: normal
status: open
title: Invalid coding error hidden on Windows
type: compile error
versions: Python 3.7
Added file: https://bugs.python.org/file48300/log_monitor.py

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



[issue6818] remove/delete method for zipfile/tarfile objects

2014-10-22 Thread Yuval Greenfield

Yuval Greenfield added the comment:

Ping. Has this been postponed?

--

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



[issue17927] Argument copied into cell still referenced by frame

2013-05-07 Thread Yuval Greenfield

Changes by Yuval Greenfield ubershme...@gmail.com:


--
nosy: +ubershmekel

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



[issue13968] Support recursive globs

2012-05-06 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

So, anybody for or against this patch? I'd really like to see this feature make 
its way in...

--

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



[issue14719] Lists: [[0]*N]*N != [[0 for _ in range(N)] for __ in range(N)]

2012-05-04 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

This isn't a bug and should be closed. It's more of a stack overflow question.

If you'd like to change this fundamental behavior of a very common operation in 
python you should make a proposal to the python ideas mailing list at 
http://mail.python.org/mailman/listinfo/python-ideas

In your example board_2 is equivalent to:

row = [0] * N
board_2 = row * N

All the rows are the same initial row. As opposed to board_1 where each row is 
a new row.

Try this:

[id(i) for i in board_2]

The initial equivalence is because they do represent the same values (NxN list 
of all zeroes). What should python compare if not by values?

--
nosy: +ubershmekel

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



[issue14315] zipfile.ZipFile() unable to open zip File

2012-04-29 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

If we're modifying zipfile, please consider adding the reviewed patch for 
ZipFile.remove at http://bugs.python.org/issue6818

--
nosy: +ubershmekel

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



[issue6818] remove/delete method for zipfile/tarfile objects

2012-04-26 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I'm not sure I understand how http://bugs.python.org/review/6818/show works. 
I've looked all over and only found remarks for zipfile.remove.patch and not 
for zipfile.remove.2.patch which addressed all the aforementioned issues.

Also, I don't understand how to add myself to the CC of this issue's review 
page.

--

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



[issue13968] Support recursive globs

2012-04-25 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I added the doublestar functionality to iglob and updated the docs and tests.

Also, a few readability renames in that module were a long time coming.

I'd love to hear your feedback.

--
Added file: http://bugs.python.org/file25360/glob.doublestars.patch

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



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Yuval Greenfield

New submission from Yuval Greenfield ubershme...@gmail.com:

This is the line in question: 
http://hg.python.org/cpython/file/293180d199f2/Lib/http/server.py#l527

I was trying to test out a few html files using python -m http.server and it 
took 4 seconds for each request, it was completely unusable. I had to do hula 
hoops to find out that it was Python's fault. The function self.address_string 
is used in every log, meaning every request makes a reverse DNS query before 
responding. This function failed for every request. Now I know this may be my 
network's fault but that doesn't mean the server has to die with it. I think 
the better solution would be to just print out the ip address like other 
popular servers do. There's no need to be fancy with server names in the log of 
our toy server, especially when it may come at such a high price.

--
components: Library (Lib)
messages: 158737
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: Python http.server is dead slow using gethostbyaddr/getfqdn for each 
request
versions: Python 3.4

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



[issue14622] Python http.server is dead slow using gethostbyaddr/getfqdn for each request

2012-04-19 Thread Yuval Greenfield

Changes by Yuval Greenfield ubershme...@gmail.com:


--
type:  - performance

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



[issue6085] Logging in BaseHTTPServer.BaseHTTPRequestHandler causes lag

2012-04-19 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I agree with Antoine on this. Though the suggested patch is wrong. I believe we 
should leave address_string alone. Simply stop the log_message method from 
using it.

Either way we'd be changing the log format but if we don't have to then we 
shouldn't completely change the meaning of a method while leaving its name 
intact.

--
nosy: +ubershmekel

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



[issue13968] Support recursive globs

2012-04-01 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I found this comprehensive description of the '**' convention at 
http://www.codeproject.com/Articles/2809/Recursive-patterned-File-Globbing that 
can translate directly to unittests.

I'd like to fix the patch for these specs but should it be in a new rglob 
function or in the existing glob.glob()? I think it should be a new one to 
avoid any edge-case compatibility concerns even though on face value there 
shouldn't be any.

--

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



[issue13968] Support recursive globs

2012-04-01 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I don't have a strong opinion on rglob vs glob so whichever way the majority 
here thinks is fine by me.

--

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




[issue13968] Support recursive globs

2012-04-01 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

On Sun, Apr 1, 2012 at 4:42 PM, Serhiy Storchaka rep...@bugs.python.org wrote:
 For ** globbing see http://ant.apache.org/manual/dirtasks.html#patterns

They mention that mypackage/test/ is interpreted as if it were 
mypackage/test/** so that's not really an option. I'm pretty sure we should 
only recurse if ** appears explicitly.

 If we extend pattern syntax of templates, why not implement Perl, Tcl or
 Bash extensions?


I'm not sure what you mean here but if it's that ##{} stuff then it should 
probably be discussed in a separate issue as it's not related to recursive 
globs.

--

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



[issue14008] Python uses the new source when reporting an old exception

2012-02-14 Thread Yuval Greenfield

New submission from Yuval Greenfield ubershme...@gmail.com:

I ran the following code:

import time
time.sleep(10)
print 1 / 0


And then modified the source before it hit the exception, python prints out the 
wrong lines from the new source file.


e:\Dropbox\dev\python\metricbotc:\python32\python test.py
Traceback (most recent call last):
  File test.py, line 3, in module
alkdf;alsdkf;l
ZeroDivisionError: division by zero


What should have been printed out:

e:\Dropbox\dev\python\metricbottest.py
Traceback (most recent call last):
  File E:\Dropbox\dev\python\metricbot\test.py, line 3, in module
print 1 / 0
ZeroDivisionError: integer division or modulo by zero


Although this is a toy example, I did run in to the problem when working on a 
long running script that I was upgrading.

Tested it and got the same results on python 2.7 and 3.2.

--
components: Interpreter Core
messages: 153337
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: Python uses the new source when reporting an old exception
type: behavior
versions: Python 3.3

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



[issue8087] Unupdated source file in traceback

2012-02-14 Thread Yuval Greenfield

Changes by Yuval Greenfield ubershme...@gmail.com:


--
nosy: +ubershmekel

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



[issue13968] Support recursive globs

2012-02-13 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I noticed this implementation on PyPI http://packages.python.org/rglob/ which 
sort of has rglob defined as

def rglob(pattern, base='.'):

Which seems like the most comprehensible way of doing this, though not the most 
compact.

The code itself isn't in the best shape 
http://cpiekarski.com/2011/09/23/python-recursive-glob/ eg it uses list 
comprehensions instead of generators. But I think I like this API better as it 
really is easier to explain.

--

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



[issue13968] Support recursive globs

2012-02-12 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

Raymond Hettinger, by simple do you mean a single argument rglob function? Or 
do you mean you prefer glob doesn't get a new function?

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

Thanks for the bug find Antoine, I worked surprisingly hard trying to make this 
right in more edge cases and while fixing it I noticed rglob/globtree has 3 
options:

* Behave like a glob for every subdirectory. Meaning that every relative path 
gets a '*/' prepended to it. Eg rglob('c/d') started from the directory 'a' 
will yield 'a/b/c/d'.

* Behave like a glob for every subdirectory of the directory in the filter 
string. Meaning rglob('c/d') from dir 'a' won't yield 'a/b/c/d'. It would try 
to walk from 'a/c' and yield nothing if the directory 'c' doesn't exist in 'a'. 
Note that if the directory 'c' does exist then '/a/c/f/d' would be yielded. 
That seems kind of quirky to me.

* Behave like a filtered walk. Meaning that in order to yield files nested in 
subdirectories a wildcard must be introduced. Eg rglob('c/d') started from the 
directory 'a' won't yield 'a/b/c/d'. For that to occur you would need to use 
rglob('*c/d') or rglob('*/c/d'). What's more unfortunate is that rglob('d') 
doesn't yield 'a/b/c/d' which seems wrong. So I think for this we should 
special case paths that don't have path separators and prepend the */. Though 
some may argue it's wrong that rglob('d') yields 'a/b/c/d' even though 
rglob('c/d') won't yield it, I think that's the correct choice for this route.

Note that absolute paths with/without wildcards don't have this ambiguity. In 
both rel/abs wildcards should match directories and files alike.

Which option do you guys think would be best? I already have a fixed patch for 
option 1 and 3 but I'd rather hear your thoughts before I introduce either.



P.s. another slight issue I ran into is the fact that fnmatch doesn't ignore 
os.curdir:

 fnmatch.fnmatch('./a', 'a')
False

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

 I have to say that the non-obvious subtleties you point out in your rglob 
 make me think I personally would probably opt to use Nick's module directly 
 instead, so that I was sure what I was getting.

I didn't notice these corner cases initially because of their distance from the 
main use case. The main use-case is to glob the current directory or an 
absolute path tree using a wildcard, esp for finding all files of a given type. 
This leaves no ambiguity.

I'd like the edge cases of relative paths to behave in a documented and 
sensible way, but they pale in comparison to the usefulness of the proposal 
imho.

I believe we should decide what's the most useful and sensible behavior and 
have a shortcut for that.

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

 * Behave like a glob for every subdirectory. Meaning that every
 relative path gets a '*/' prepended to it. Eg rglob('c/d') started
 from the directory 'a' will yield 'a/b/c/d'.

 That's what I would expect. That way, rglob('__init__.py') would
 find all files named __init__.py beneath the current directory.

Perhaps we should make a single exemption for double dots eg 
rglob('../../__init__.py') starts the walk 2 folders out of the curdir and 
looks for '*/__init__.py'.

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

 This would be quirky. I don't think '..' should be treated specially.
 (there's also the symlinks problem)

Again with 'a/b/c/d' and let's add a file 'a/b/png'.

If the curdir is 'c' and you use rglob('../pn*') you won won't find '../png' as 
you would be walking only in the curdir. I think that route would mean we 
should document double dots aren't supported.

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

 That depends how you implement it. If you detect that .. exists and
glob for pn* inside it, you will probably find ../png.

Yes, that's what I meant by a single exemption for double dots. The solution 
should start the walk from wherever the double dots lead it to.

I believe we agree.

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

 you should use the same algorithm for all globs (e.g. a/*.py), shouldn't 
 you?

That specific string would start the walk from the current directory IIUC.

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

Given

  /home/a
  /home/a/k.py
  /home/a/c/j.py
  /home/b/z.py
  /home/b/c/f.py

and a current directory of /home/a, we'd have:

   pattern matches
   --- ---
   *.pyk.py, c/j.py
   c/*.py  c/j.py
   c*  c
   ../*.py ../a/k.py, ../a/c/j.py, ../b/z.py, ../b/c/f.py
   ../c/*.py   ../b/c/f.py, ../a/c/j.py

For relative paths the double dots decide where to start walking and from then 
on you can imagine a glob on every subdir. In the last 2 examples the glob 
would have been '*.py' and 'c/*.py' respectively.

--

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



[issue13968] Support recursive globs

2012-02-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

As R. David Murray has suggested I think there may be a middle ground.

def rglob(fn_filter, root='.'):

That would mean the default use case is still easy to remember as rglob('*.py') 
and also there aren't any explanations needed for how this function works.

Though I'm not sure which of these API's I like better.

--

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



[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Yuval Greenfield

New submission from Yuval Greenfield ubershme...@gmail.com:

This is a feature I've wanted to use in too many times to remember. I've made a 
patch with an implementation, docs and a test. I've named the function rglob 
and tried to stay within the conventions of the glob package.

--
components: Library (Lib)
files: rglob.patch
keywords: patch
messages: 152843
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: Add a recursive function to the glob package
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file24451/rglob.patch

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



[issue13968] Add a recursive function to the glob package

2012-02-08 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I'd say it's very close to a duplicate but maybe isn't so. If walkdir is added 
then rglob can be implemented using it.

I'd say rglob to walkdir is like urlopen to http.client. One is the 
stupid and simple function (that still has a bazillion use cases) and the other 
is the heavy lifting swiss army knife.

file_paths(filtered_walk('.', included_files=['*.py'])) is a lot longer than 
rglob('*.py').

--

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



[issue9285] Add a profile decorator to profile and cProfile

2012-01-25 Thread Yuval Greenfield

Changes by Yuval Greenfield ubershme...@gmail.com:


--
nosy: +ubershmekel

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I use python a lot with Hebrew and many websites have internationalization 
which may involve unicode paths. I agree that saying unicode paths are rare 
is inaccurate. 

If the current situation isn't fixed though - you just can't use the resulting 
path for almost anything. Do you have a use case Ishimoto?

Windows XP and up implement paths as unicode, that means that a bytes api 
doesn't even make sense unless python does some encoding and decoding for you. 
E.g. python can use the unicode API's internally and return utf-8 encoded 
bytes. But you couldn't use these paths outside of python. The fact is you 
shouldn't be doing os.path.abspath(b'.') in windows to begin with.

--

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

Another option btw is to use utf-16, which will work but it's a bit ugly as 
well:

 os.listdir(os.path.abspath(u'.').encode('utf-16'))
[]
 os.path.abspath(u'.')
u'C:\\Users\\alon\\Desktop\\\u05e9\u05dc\u05d5\u05dd'
 os.path.abspath(u'.').encode('utf-16')
'\xff\xfeC\x00:\x00\\\x00U\x00s\x00e\x00r\x00s\x00\\\x00a\x00l\x00o\x00n\x00\\\x
00D\x00e\x00s\x00k\x00t\x00o\x00p\x00\\\x00\xe9\x05\xdc\x05\xd5\x05\xdd\x05'
 os.listdir(os.path.abspath(u'.').encode('utf-16'))
[]

Tested on python 2.7, but you know what I mean.

--

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-26 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

It won't break existing code. Ignoring this problem here only moves the 
exception to whenever the data returned is first used.

Any code this fix breaks is already broken.

--

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-24 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

An example error with abspath and bytes input:

 os.path.abspath('.')
'C:\\Users\\yuv\\Desktop\\YuvDesktop\\\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5'
 os.path.abspath(b'.')
b'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??'
 os.listdir(os.path.abspath(b'.'))
Traceback (most recent call last):
  File stdin, line 1, in module
WindowsError: [Error 123] The filename, directory name, or volume label 
syntax is incorrect: 'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??/*.*'



I couldn't follow the implementation, I got stuck not being able to locate the 
definition for os.getcwdb so I couldn't join you for that part. Here's another 
possible solution:

 win32api.GetFullPathName('.')
'C:\\Users\\yuv\\Desktop\\YuvDesktop\\\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5'
 win32api.GetShortPathName(win32api.GetFullPathName('.'))
'C:\\Users\\yuv\\Desktop\\YUVDES~1\\5F30~1'

The short path is ascii but the problem is not all windows file systems have 
8.3 filenames [1]. So I think your suggestion is the best solution.

[1] 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#short_vs._long_names

--

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



[issue13247] os.path.abspath returns unicode paths as question marks

2011-10-22 Thread Yuval Greenfield

New submission from Yuval Greenfield ubershme...@gmail.com:

For Python 2:

Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit 
(Intel)] on win32
 os.path.abspath('.')
'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??'
 os.path.abspath(u'.')
u'C:\\Users\\yuv\\Desktop\\YuvDesktop\\\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5'

For Python 3:
Python 3.2 (r32:88445, Feb 20 2011, 21:29:02) [MSC v.1500 32 bit (Intel)] 
on win32
 os.path.abspath('.')
'C:\\Users\\yuv\\Desktop\\YuvDesktop\\\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5'
 os.path.abspath(b'.')
b'C:\\Users\\yuv\\Desktop\\YuvDesktop\\??'


The returned path with question marks is completely useless. It's better that 
python throw an error than return the question marks. Another option is to try 
and get the ascii version of the path, I believe windows has one.

--
components: Library (Lib)
messages: 146204
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: os.path.abspath returns unicode paths as question marks
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue11799] urllib HTTP authentication behavior with unrecognized auth method

2011-04-07 Thread Yuval Greenfield

New submission from Yuval Greenfield ubershme...@gmail.com:

When trying to use urllib to open a page from a server with NTLM authentication 
python raises urllib.error.HTTPError: HTTP Error 401: Unauthorized

A python 3 code example: http://codepad.org/axPomYHw

This was a bit confusing for me as I had to debug urllib to figure out python 
doesn't support NTLM. I'd expect python to tell me the authentication method 
isn't supported in such cases.

I didn't add a test for the attached patch as it doesn't seem test-worthy.

--
components: Library (Lib)
files: urllib.auth.patch
keywords: patch
messages: 133248
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: urllib HTTP authentication behavior with unrecognized auth method
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file21567/urllib.auth.patch

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



[issue11799] urllib HTTP authentication behavior with unrecognized auth method

2011-04-07 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I noticed it's not only that python doesn't support NTLM, it's that I used 
Basic Auth which isn't NTLM. So I modified the patch to pertain to basic auth 
and digest as well.

--
Added file: http://bugs.python.org/file21574/urllib.auth2.patch

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



[issue11645] Pypi reviews Expand 10 after shows a duplicate line

2011-03-22 Thread Yuval Greenfield

New submission from Yuval Greenfield ubershme...@gmail.com:

Just try and review any patch diff, eg 
http://bugs.python.org/review/6818/diff/2113/4194 and click Expand 10 after 
on either side (top or bottom) of the diff chunk. Notice that a duplicate line 
is introduced.

--
messages: 131819
nosy: ubershmekel
priority: normal
severity: normal
status: open
title: Pypi reviews Expand 10 after shows a duplicate line
type: behavior

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



[issue6818] remove/delete method for zipfile/tarfile objects

2011-03-14 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

Fixed the bugs Martin pointed out and added the relevant tests. Sadly I had to 
move some stuff around, but I think the changes are all for the better. I 
wasn't sure about the right convention for the 2 constants I added btw.

--
Added file: http://bugs.python.org/file21188/zipfile.remove.2.patch

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



[issue6818] remove/delete method for zipfile/tarfile objects

2011-03-09 Thread Yuval Greenfield

Yuval Greenfield ubershme...@gmail.com added the comment:

I fixed the bugs I found, added tests and documentation. What do you guys think?

--
keywords: +patch
Added file: http://bugs.python.org/file21063/zipfile.remove.patch

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