[issue36480] .strip() unexpected output on Windows

2019-03-30 Thread 78


78 <78alphadevi...@gmail.com> added the comment:

I have read the documentation. It didn't function near what I thought it
did. I've never heard it stripping front and back characters in tutorials.

I solely admit I was wrong in assuming its function.

On Sat, Mar 30, 2019, 3:35 PM Eric V. Smith  wrote:

>
> Eric V. Smith  added the comment:
>
> I cannot run that example on my computer.
>
> Please reduce this to a single line of code, with no imports, that calls
> .strip() and shows your problem. Ideally you will just use constants, and
> not computed strings.
>
> Something like:
>
> >>> 'magenta.zip'.strip('pizamn')
> 'genta.'
>
> And also, show that exact same line of code executed on both platforms.
>
> That said, the problem is likely in your usage of .strip(). Please re-read
> the documentation: it does not remove substrings from a given string, it
> removes any of the given characters from the beginning and end of the
> string.
>
> So, this is correct:
> >>> 'magenta.zip'.strip('pm')
> 'agenta.zi'
>
> You're probably seeing some difference due to upper or lower case
> filenames on the two platforms.
>
> --
>
> ___
> Python tracker 
> <https://bugs.python.org/issue36480>
> ___
>

--

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



[issue36480] .strip() unexpected output on Windows

2019-03-30 Thread 78


78 <78alphadevi...@gmail.com> added the comment:

import binascii
import os
import re
import sys
import hashlib
import json
import codecs
import threading
import datetime
from multiprocessing.pool import ThreadPool

try:
import PySimpleGUI_Custom as sg
except:
import PySimpleGUI as sg
import time
import multiprocessing
import sys
import pathlib
import random
import io
from PIL import Image
import base64
import multiprocessing

t1 = time.time()
settings = json.load(open("{}settings.txt".format(home_), 'r'))
security = True if settings["SECURITY"] == "True" else False
cpu_ = int(settings["THREADS"])
pool = ThreadPool(processes=int(cpu_))
comp_hash_other_2 = json.load(open('{}{}'.format(home_,
"Input_Data_Hash.txt"), 'r'))
comp_hash_other_ = json.load(open('{}{}'.format(home_,
"Output_Image_Hash.txt"), 'r'))
sort_n(name)
dig = 0
file_lim = len(name) - 1
file_len = len(name)
check = 0
b1 = 0
b2 = 0
b3 = 0
b4 = 0
for i in range(0, new_len):
event, values = main_window.Read(timeout=0)
if dig is file_len or event == "Button":
break
content = open("{}{}".format(input_, str(name[dig])), 'rb').read()
temp_name = str(name[dig]).strip("-{}.bmp".format(dig))
file_ = "{}{}".format(output_, str(temp_name))
open(file_, 'ab').write(content[96:])
dig += 1
progress_bar.UpdateBar(i)
progress_percent.Update(f"{i * 100 // new_len}%")
progress_bar.UpdateBar(current_count=1, max=1)
progress_percent.Update("100%")
check_value = dig / new_len

# The strip method works on all *Nix platforms without error, such
that magenta.zip is magenta.zip

# However, testing it on windows, magenta.zip was turned into agenta.zi

# Testing on Window: https://photos.app.goo.gl/uF1LVG2TyYk33UQy6

On Fri, Mar 29, 2019 at 5:51 PM Eric V. Smith 
wrote:

>
> Eric V. Smith  added the comment:
>
> Please provide the exact code to duplicate the problem.
>
> I suspect this is a problem with your code, not with str.strip and not
> with Windows.
>
> --
> nosy: +eric.smith
> status: open -> pending
>
> ___
> Python tracker 
> <https://bugs.python.org/issue36480>
> ___
>

--
status: pending -> open

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



[issue36480] .strip() unexpected output on Windows

2019-03-29 Thread 78


New submission from 78 <78alphadevi...@gmail.com>:

Using .strip() on windows leads to the first and last character of a word being 
deleted.

Magenta.zip becomes agenta.zi

--
components: Windows
messages: 339164
nosy: 78Alpha, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: .strip() unexpected output on Windows
type: behavior
versions: Python 3.7

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