Addind hide information to a file of NTFS
-
Hello! I have seen example of a code that was written with using python 3.-- but i work with 2.7 and i don't know how to fix a problem with coding symbols from extensional latin. I suppose that there is little error with syntax. But ok will use Python 3. In this code - example i work with a NTFS-file, which allow you add some additional information for effective using. Here it use for translating some word in different languages. When i input a desire word which i want to translate i get a error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128). I write some comments to my lines. When the block "Write streams" begins to work - is print only first 2 streams even i input any word which include usuallatin simbols, for example: "White". But, if i work in python 3 - it code works but i get following error. I parse my list named DATA to the list WORDS and i'd to write this content in a streams in 3 languages, but if i use this:
with open(filestream, mode='w', encoding='utf8') as stream:
stream.write(stream_content(dataitem))i get incorrect content after reading. It looks like as:
T:
r
R:
o
R:
o
J:
u
R:
o
B:
e
D:
o
T:
w
S:
t
S:
t
O:
p
W:
h
Y:
e
C:
a
B:
u
T:
r
C:
y
M:
o
P:
e
Д:
о
Д:
о
У:
ч
У:
с
П:
е
О:
п
О:
п
Д:
в
К:
р
К:
р
Р:
а
Б:
е
Ж:
ё
В:
о
В:
о
В:
о
В:
е
М:
о
П:
е
K:
r
Ú:
t
Ú:
t
E:
l
K:
ö
V:
e
E:
g
S:
z
V:
e
V:
e
F:
e
S:
á
G:
é
B:
u
T:
e
K:
e
M:
o
G:
yAlso i have a mistake, when i try return Word from function find_language. As i know if i put Word in some list and try to return it as list[0], because Word it is single right value, which i try to get through the loop for it in range(len(Result)):
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 31 03:33:00 2016@author: SKY_SHY
"""from codecs import open
def stream_content(data):
return '\n'.join(item[0] + ':\n ' + '\n '.join(item[1]) for item in data)filename = "DATA_"
def translate():
Des_word = input("Enter a word you desire to translate:")# here i input a word, which i desire to translate in another language
print ('EN = 0', 'RU = 1', 'HU = 2')
Des_language = int(input("Select a language:"))# here i define a language, to which i desire -
Hello! I have seen example of a code that was written with using python 3.-- but i work with 2.7 and i don't know how to fix a problem with coding symbols from extensional latin. I suppose that there is little error with syntax. But ok will use Python 3. In this code - example i work with a NTFS-file, which allow you add some additional information for effective using. Here it use for translating some word in different languages. When i input a desire word which i want to translate i get a error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128). I write some comments to my lines. When the block "Write streams" begins to work - is print only first 2 streams even i input any word which include usuallatin simbols, for example: "White". But, if i work in python 3 - it code works but i get following error. I parse my list named DATA to the list WORDS and i'd to write this content in a streams in 3 languages, but if i use this:
with open(filestream, mode='w', encoding='utf8') as stream:
stream.write(stream_content(dataitem))i get incorrect content after reading. It looks like as:
T:
r
R:
o
R:
o
J:
u
R:
o
B:
e
D:
o
T:
w
S:
t
S:
t
O:
p
W:
h
Y:
e
C:
a
B:
u
T:
r
C:
y
M:
o
P:
e
Д:
о
Д:
о
У:
ч
У:
с
П:
е
О:
п
О:
п
Д:
в
К:
р
К:
р
Р:
а
Б:
е
Ж:
ё
В:
о
В:
о
В:
о
В:
е
М:
о
П:
е
K:
r
Ú:
t
Ú:
t
E:
l
K:
ö
V:
e
E:
g
S:
z
V:
e
V:
e
F:
e
S:
á
G:
é
B:
u
T:
e
K:
e
M:
o
G:
yAlso i have a mistake, when i try return Word from function find_language. As i know if i put Word in some list and try to return it as list[0], because Word it is single right value, which i try to get through the loop for it in range(len(Result)):
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 31 03:33:00 2016@author: SKY_SHY
"""from codecs import open
def stream_content(data):
return '\n'.join(item[0] + ':\n ' + '\n '.join(item[1]) for item in data)filename = "DATA_"
def translate():
Des_word = input("Enter a word you desire to translate:")# here i input a word, which i desire to translate in another language
print ('EN = 0', 'RU = 1', 'HU = 2')
Des_language = int(input("Select a language:"))# here i define a language, to which i desireWrong forum - we don't have a Python forum atm, but you'd have bette link in the Web Development Discussion Boards[^] or Linux, Apache, MySQL, PHP Discussion Boards[^] forums, I think.
Cheers, Mick ------------------------------------------------ It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
-
Hello! I have seen example of a code that was written with using python 3.-- but i work with 2.7 and i don't know how to fix a problem with coding symbols from extensional latin. I suppose that there is little error with syntax. But ok will use Python 3. In this code - example i work with a NTFS-file, which allow you add some additional information for effective using. Here it use for translating some word in different languages. When i input a desire word which i want to translate i get a error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128). I write some comments to my lines. When the block "Write streams" begins to work - is print only first 2 streams even i input any word which include usuallatin simbols, for example: "White". But, if i work in python 3 - it code works but i get following error. I parse my list named DATA to the list WORDS and i'd to write this content in a streams in 3 languages, but if i use this:
with open(filestream, mode='w', encoding='utf8') as stream:
stream.write(stream_content(dataitem))i get incorrect content after reading. It looks like as:
T:
r
R:
o
R:
o
J:
u
R:
o
B:
e
D:
o
T:
w
S:
t
S:
t
O:
p
W:
h
Y:
e
C:
a
B:
u
T:
r
C:
y
M:
o
P:
e
Д:
о
Д:
о
У:
ч
У:
с
П:
е
О:
п
О:
п
Д:
в
К:
р
К:
р
Р:
а
Б:
е
Ж:
ё
В:
о
В:
о
В:
о
В:
е
М:
о
П:
е
K:
r
Ú:
t
Ú:
t
E:
l
K:
ö
V:
e
E:
g
S:
z
V:
e
V:
e
F:
e
S:
á
G:
é
B:
u
T:
e
K:
e
M:
o
G:
yAlso i have a mistake, when i try return Word from function find_language. As i know if i put Word in some list and try to return it as list[0], because Word it is single right value, which i try to get through the loop for it in range(len(Result)):
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 31 03:33:00 2016@author: SKY_SHY
"""from codecs import open
def stream_content(data):
return '\n'.join(item[0] + ':\n ' + '\n '.join(item[1]) for item in data)filename = "DATA_"
def translate():
Des_word = input("Enter a word you desire to translate:")# here i input a word, which i desire to translate in another language
print ('EN = 0', 'RU = 1', 'HU = 2')
Des_language = int(input("Select a language:"))# here i define a language, to which i desireThe error message suggest that you are trying to process Unicode text with a program that only handles ASCII. It would help if you remove all the code not relevant to the problem, and also indicate exactly where the failure occurs. Also, Python questions are more likely to get an answer when posted at [Quick Answers](https://www.codeproject.com/Questions/ask.aspx).
-
Wrong forum - we don't have a Python forum atm, but you'd have bette link in the Web Development Discussion Boards[^] or Linux, Apache, MySQL, PHP Discussion Boards[^] forums, I think.
Cheers, Mick ------------------------------------------------ It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
Actually [Quick Answers](https://www.codeproject.com/Questions/ask.aspx) is the place.