[issue30906] os.path.join misjoins paths

2017-07-12 Thread mesheb82

mesheb82 added the comment:

Testing on Python 2.7.12 on through Windows 10 bash (so Linux), I find an 
inconsistency with the documented statement "If a component is an absolute 
path, all previous components are thrown away and joining continues from the 
absolute path component"

>>> os.path.join('dir', 'C:/dir2')
'dir/C:/dir2'

To me, the is very similar to the original problem (Windows 10 Python 2.7.13 
and 3.6.1):

>>> os.path.join('dir1', '/dir2')
'/dir2'

I would argue that on Windows, '/dir2' is not an absolute path.  Testing from 
cmd and powershell on Windows 10 from `C:`
>>> cd /dir2
C:/dir2

I do agree though that is a terrible idea to not respect the second parameter 
in:
os.path.join(absolute_path_or_local_path, absolute_path)

I think the question is what is considered an absolute path and does that 
change depending on the OS?

--

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



[issue30906] os.path.join misjoins paths

2017-07-11 Thread mesheb82

New submission from mesheb82:

I'm trying to join paths on Windows with data taken from a user generated file. 
 In doing so, I came across:

>>> os.path.join('dir1', '/dir2')
'/dir2'

I'd expect an error or:

'dir1\\dir2'

This has been tested and is consistent with Python 2.7.13 and 3.6.1.

--
components: Library (Lib), Windows
messages: 298181
nosy: mesheb82, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.path.join misjoins paths
versions: Python 2.7, Python 3.6

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



[issue29628] struct objects can no longer be pickled

2017-02-22 Thread mesheb82

mesheb82 added the comment:

Thank you.

On Wed, Feb 22, 2017 at 9:22 PM, Serhiy Storchaka <rep...@bugs.python.org>
wrote:

>
> Serhiy Storchaka added the comment:
>
> > When I run the following code on Windows/Linux for < Python 3.6, I have
> no problems.
>
> You have a problem. Did you try to use the copied object? It is a broken
> Struct object.
>
> >>> copied = copy.deepcopy(this_fails)
> >>> copied.format
> >>> copied.size
> -1
> >>> copied.pack(42)
> Traceback (most recent call last):
>   File "", line 1, in 
> struct.error: pack expected -1 items for packing (got 1)
> >>> copied.unpack(b'abcd')
> Traceback (most recent call last):
>   File "", line 1, in 
> struct.error: unpack requires a bytes object of length -1
>
> Copying Struct object never worked. Now it raises an error rather than
> silently creating a broken object.
>
> --
> nosy: +serhiy.storchaka
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker <rep...@bugs.python.org>
> <http://bugs.python.org/issue29628>
> ___
>

--

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



[issue29628] struct objects can no longer be pickled

2017-02-22 Thread mesheb82

New submission from mesheb82:

When I run the following code on Windows/Linux for < Python 3.6, I have no 
problems.  When I run in Python 3.6.0, I get the subsequent traceback.

I checked the release notes and only saw the following struct module note 
related to half-floats: Issue #11734

from struct import Struct
import copy
this_fails = Struct('<i')
copy.deepcopy(this_fails)


Traceback (most recent call last):
  File "test_script.py", line 12, in 
copy.deepcopy(this_fails)
  File "F:\Anaconda\envs\py36\lib\copy.py", line 169, in deepcopy
rv = reductor(4)
TypeError: can't pickle Struct objects


To be clear, I'm copying struct objects as part of a larger class.  As I'm 
running many function calls where I create the same struct objects, saving the 
common struct objects allows me to get a factor of 2x speedup on my code.  
Deleting the saved struct objects at the end of file reading (and before the 
deepcopy takes place) fixes the problem.

--
components: Windows
messages: 288401
nosy: mesheb82, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: struct objects can no longer be pickled
type: crash
versions: Python 3.6

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



[issue15774] String method title() produces incorrect resutls

2012-08-23 Thread mesheb82

New submission from mesheb82:

I got unexpected results when working with a string that has an apostrophe in 
it.
Joe's.title()
 Joe'S

'Joes'.title()
 'JoeS'

--
components: Interpreter Core
messages: 168969
nosy: mesheb82
priority: normal
severity: normal
status: open
title: String method title() produces incorrect resutls
versions: Python 2.6

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



[issue14897] struct.pack raises unexpected error message

2012-05-24 Thread mesheb82

New submission from mesheb82 meshe...@gmail.com:

I found some unexpected behavior while working with the struct module.
 import struct

This works as expected:
 struct.pack('1s1s','3','4')
'34'

In this case, with bad input, the error message says I need 2 arguments, when I 
provide 2 arguments.
 struct.pack('1s1s','33')
Traceback (most recent call last):
  File stdin, line 1, in module
struct.error: pack requires exactly 2 arguments

--
components: IO
messages: 161481
nosy: mesheb82
priority: normal
severity: normal
status: open
title: struct.pack raises unexpected error message
type: behavior
versions: Python 2.7, Python 3.2

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



[issue14897] struct.pack raises unexpected error message

2012-05-24 Thread mesheb82

mesheb82 meshe...@gmail.com added the comment:

Also, I tested this on Windows in Python 3.2.3 and Windows in Python 2.7.2

--

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



[issue14677] Python 2.6 Printing Error

2012-04-26 Thread mesheb82

New submission from mesheb82 meshe...@gmail.com:

I’m running:
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit (Intel)] on 
win32

I was testing out some print functionality and I made an error in typing (I 
meant to use %8.8f), but is this behavior intentional or is it an error?
 print '%8.8s' %(101.)
 '1000'


I would expect this to return a TypeError.

I also tested this on Python 2.4 and Python 2.5 on linux and had the same 
behavior.

Steve

--
components: IO
messages: 159403
nosy: mesheb82
priority: normal
severity: normal
status: open
title: Python 2.6 Printing Error
versions: Python 2.6

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