All Questions
422 questions
0
votes
1
answer
30
views
Parsing of CSV-File leads to "NBSP" and "SPA" Characters in Windows
I am parsing a CSV document to write a specification in SysML v2, which is essentially just a simple text file.
Parsing it on Linux I get the result I desire. I use a SysOn-Docker to display my SysML ...
2
votes
2
answers
75
views
os.device_encoding changes when called from a subprocess, causing decoding error on Windows. How to force encoding in subprocess?
I have the following Python 3.7 code in an imported package, not modifiable by myself, that reads and decodes the systems CCompiler name provided by disttools:
subproc.py
import os
import sys
import ...
2
votes
0
answers
136
views
Failed to fetch file gs://chromium-clang-format/025ca7c75f37ef4a40f3a67d81ddd11d7d0cdb9b - Error while executing "gclient sync"
I am working on a remote machine to set up the release build for my application. We have depot_tools dependencies, so while executing the gclient sync command, we are facing some Python-related issues....
0
votes
0
answers
54
views
Create two functions to encode and then decode a string using the Rail Fence Cipher
This cipher is used to encode a string by placing each character successively in a diagonal along a set of "rails". First start off moving diagonally and down. When you reach the bottom, ...
0
votes
1
answer
63
views
Unicode strings in a purely python3 codebase - are these useless? [duplicate]
In the codebase that I'm working on, there seems to be remnants of python2 because a lot of the strings are prefixed with u.
From researching, it looks like this denotes a unicode string, but in ...
-1
votes
1
answer
104
views
Why does b'\x30' show up as 0?
If I try to output print(b'\x30') it shows as 0. Similarly b'\x31' is displayed as 1, etc. I need this byte string (class ) to be displayed, but with ONLY one backslash.
I tried
s = br"\x30"
...
0
votes
1
answer
192
views
How to manipulate/join multiple strings containing UTF-8 characters
My code needs to be compatible with both Python 2.x and 3.x versions. I am getting both string as input to my function, and I need to do some manipulation on those:
if len(str1) > 10:
str1 = ...
1
vote
1
answer
172
views
Reading binary signed, trailing sign integers from mainframes
I'm attempting to read what I believe is a fixed-width file into Python. Haven't typically had to deal with encoding issues before, and this one stumps me a bit.
File has no extension, I believe its ...
0
votes
1
answer
76
views
Open file in Python that the open() function cannot handle
In python, trying to open a file path that was obtained using glob.glob i suspect that the path contains characters with a different encoding to what open() can handle not sure tho. i can skip the ...
1
vote
1
answer
438
views
Use argon2 to generate a key usable for Fernet
My goal: Take a plain-text password and generate a 32 byte token that can be used for Fernet encryption.
What I've tried so far:
>>> from cryptography.fernet import Fernet
>>> import ...
1
vote
1
answer
81
views
how to solve Exception has occurred: UnicodeEncodeError?
I tried to run this code
ins = insightsearch.Analysis(
df='encodedreviews.csv',
column_name="Text",vader=False
)
# returns html file with insights visualisation
ins....
0
votes
0
answers
103
views
Polish characters not display in PySpark
I am using PySpark on Jupyter Notebook with Python 3.6 and Spark 3.3.
When I am trying to display some polish characters i obtain "?" instead of them.
Here is the sample of my code and ...
0
votes
1
answer
30
views
How to encode in 10 different class the last two words from multiple .csv files in a folder?
I have a folder with 468 .csv files (Folder_file1_MR, Folder_file2_MR, ...., Folder_file6_MW), and the name of each .csv file ends with two letters corresponding to a specific class. In total, there ...
2
votes
3
answers
2k
views
Fix encoding errors in csv with mixed encodings
there are some other questions here regarding this problem, but none of them fixed my problem so far.
I have a large (40MB) CSV file. Most of the file is encoded in iso-8859-1 (latin1), but some ...
0
votes
0
answers
166
views
NumPy savetxt/loadtxt encoding unnecessary?
I use NumPy's savetxt() and loadtxt() to write and read data to and from disk. I sometimes use non-ASCII characters (e.g. Greek) in the optional heading, as in
import numpy as np
np.savetxt('test.txt',...