Python Forum
Trouble installing modules/libraries and getting Notepad++ to show cyrillic letters
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble installing modules/libraries and getting Notepad++ to show cyrillic letters
#1
Question 
Hello, everybody,

by the title of the subject you can guess I am brand new to Python and coding in general. I've tried learning it in the past but never had any really reason/need to or application. But now I do. There are quite a few things I can use Python for at work and I've seen people do them, so I know my ideas are possible- some of them even with like 10 lines of code. Here come the issues:

1. For the life of me I can't get to install modules. I am trying to install "os" and "shutil", but even after reading online and going through the python documentation I still end up getting all kind of weird errors. My pip is working, I tried updating it- still works, I can see list of pip commands so that means it's all fine, right? But no matter what I type after "pip install" I get weird errors or just nothing at all. In case this is not a simple problem I can collet all the different outcomes I get to Big Grin .
Any clues?

2. Second- cyrillic, why does everything hate it? I tried a few IDEs and text-editors, until I decided to come back to Notepad++ (I say comeback, because this was the 1st thing I used, when I had just started with some random YouTube tutorials). But the issue lies in getting cyrillic letters from my code to print as they are suppose to. I tried different encoding nothing works. If I try to print "Здравей" it comes out as random symbols or errors- depending on the encoding. But if I type something in cyrillic using input it shows perfectly fine!

For both issues I've tried looking up online- videos, forums and documentation. Best case scenario I do one step forward, two steps backwards. Any help would be appreciate as I am trying to get the hang of things.

Thank you all!
Reply
#2
(Jul-23-2022, 08:45 AM)Dragiev Wrote: am trying to install "os" and "shutil", but even after reading online and going through the python documentation I still end up getting all kind of weird errors
You shall not install os or shutil they are part of Python Standard Library.
(Jul-23-2022, 08:45 AM)Dragiev Wrote: But no matter what I type after "pip install" I get weird errors or just nothing at all. In case this is not a simple problem I can collet all the different outcomes I get to Big Grin .
Any clues?
You most post the error.
As you use Notepad ++ then you use Windows,here is the basic from command line(cmd or PowerShell) or cmder as i use.
G:\div_code
λ python -V
Python 3.10.5

G:\div_code
λ python -c "import sys; print(sys.executable)"
C:\python310\python.exe

G:\div_code
λ pip -V
pip 22.0.4 from C:\Python310\lib\site-packages\pip (python 3.10)

# When basic stuff over work install something eg Requests 
G:\div_code
λ pip install requests --upgrade
Collecting requests
  Using cached requests-2.28.1-py3-none-any.whl (62 kB)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\python310\lib\site-packages (from requests) (2.0.11)
Requirement already satisfied: certifi>=2017.4.17 in c:\python310\lib\site-packages (from requests) (2021.10.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\python310\lib\site-packages (from requests) (1.26.8)
Requirement already satisfied: idna<4,>=2.5 in c:\python310\lib\site-packages (from requests) (3.3)
Installing collected packages: requests
Successfully installed requests-2.28.1

# Test Requests work
G:\div_code
λ python
Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> 
>>> response = requests.get('http://python-forum.io')
>>> response.status_code
200
>>> response.headers['Date']
'Sat, 23 Jul 2022 10:59:24 GMT'
>>> exit()
G:\div_code
Reply
#3
Here are some images:
(I hope I have uploaded them correctly)

https://photos.app.goo.gl/m9kWGqfVKjviSkhn6 - this is what I get whenever I try to install "os", but if it comes preinstall then, I shouldn't care about this error, correct?

https://photos.app.goo.gl/4xvkcjFLUjPDL6UdA - and this is the error I get when I try to update pip, however I think this is also corrected I used the line you provided and got this:

https://photos.app.goo.gl/piG7G5s3qvtLtNVR7 - all good it seems?

However I still can't get cyrillic to work, and I am not sure why:

https://photos.app.goo.gl/xKqacwjL5CrhR53w9

I apologize if my questions are stupid, but this is what coding is like for a brand-spanking-new guy.

Thanks!
Reply
#4
(Jul-23-2022, 11:49 AM)Dragiev Wrote: https://photos.app.goo.gl/m9kWGqfVKjviSkhn6 - this is what I get whenever I try to install "os", but if it comes preinstall then, I shouldn't care about this error, correct?
You shall not install os as i posted it's a part of Python Standard Library(mean that all of this is already installed).
G:\div_code
λ python
Python 3.10.5 (tags/v3.10.5:f377153, Jun  6 2022, 16:14:13) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>>
>>> os.getcwd()
'G:\\div_code'
>>> exit()
(Jul-23-2022, 11:49 AM)Dragiev Wrote: https://photos.app.goo.gl/4xvkcjFLUjPDL6UdA - and this is the error I get when I try to update pip, however I think this is also corrected I used the line you provided and got this:
Run cmd as Administrator
Quote:https://photos.app.goo.gl/piG7G5s3qvtLtNVR7 - all good it seems?
Ok

Quote:However I still can't get cyrillic to work, and I am not sure why:
https://photos.app.goo.gl/xKqacwjL5CrhR53w9
You can not use single \ in path because of escape character.
>>> path = 'C:\Users\Tom\foo'
  File "<interactive input>", line 1
    path = 'C:\Users\Tom\foo'
                             ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Fix all of these ways works.just put r(raw string) is the easiest way,
>>> path = r'C:\Users\Tom\foo'
>>> path
'C:\\Users\\Tom\\foo'
>>> 
>>> path = 'C:\\Users\\Tom\\foo'
>>> path
'C:\\Users\\Tom\\foo'
>>> 
>>> path = 'C:/Users/Tom/foo'
>>> path
'C:/Users/Tom/foo'
Reply
#5
Adding "r" works like a charm... half the time. I also tried just putting "\\", also works IF the folder I am trying to open (I used: import os
os.startfile('folder path')) doesn't contain spaces like "Images for editing" or something like that or Cyrillic like "Изображения". If the folder name is one word in English it opens it up without an issue. So at the end... I am still stuck with my Cyrillic issues. Tried all sorts of idea I found online and non seem to work at all. Any tips about that or should I make a new thread specifically about the Cyrillic issue I am facing?

Thank you for all the help so far!!!
Reply
#6
(Jul-24-2022, 08:45 AM)Dragiev Wrote: something like that or Cyrillic like "Изображения". If the folder name is one word in English it opens it up without an issue. So at the end... I am still stuck with my Cyrillic issues.
Just to be clear so do Python not have issues with Unicode(this was one biggest changes when move to Python 3).
Eg Editors,files,Os can make some issues in when connect to Python
Some examples
>>> s = "Изображения"
>>> print(f"The Cyrillic name is {s}")
The Cyrillic name is Изображения
Read a folder with Cyrillic name and contest of file has Cyrillic and Japanese.
with open(r'G:\code\Изображения\countries1.txt', encoding='utf-8') as f:
    print(f.read())
Output:
Malaysia, Kuala Lumpur Japan, Tokyo, カタカナ or 片仮名 United States of America, Washington Canada, Ottawa Pakistan, Islamabad Cyrillic Изображения
As you see no Problems.

(Jul-24-2022, 08:45 AM)Dragiev Wrote: I tried a few IDEs and text-editors, until I decided to come back to Notepad++
If want a easy Editor try PyScripter,i use for a lot small testing of stuff
My main Editor is VS Code,also PyCharm(Free Community editon) is ok.
Dragiev likes this post
Reply
#7
Hello, yea I was aware that the issue lies in Notepad++, not in Python. I wanted to use Notepad++, but it seems like PyCharm will have to do for the time being. I had tried it before and couldn't get Cyrillic to work there, either. However I just downloaded it again and it works perfectly. Thank you for all the help! I consider this thread done and my questions answered! Very much appreciated!!!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trouble with installing python domingo251 2 603 Sep-23-2023, 12:03 AM
Last Post: ICanIBB
  encode/decode to show correct country letters in a CTk combobox janeik 2 726 Sep-02-2023, 09:46 AM
Last Post: janeik
  Having trouble installing scikit-learn via VSC and pulling my hair out pythonturtle 1 767 Feb-07-2023, 02:23 AM
Last Post: Larz60+
  List of Modules/Libraries Installed by Default? rontarrant 2 1,012 Oct-14-2022, 05:18 PM
Last Post: rontarrant
  PIL Image im.show() no show! Pedroski55 2 976 Sep-12-2022, 10:19 PM
Last Post: Pedroski55
  Installing Modules PythonBorg 10 2,066 Sep-03-2022, 09:58 AM
Last Post: PythonBorg
  PIL Image im.show() no show! Pedroski55 6 4,946 Feb-08-2022, 06:32 AM
Last Post: Pedroski55
  Logging /w several modules/libraries Lou 3 1,930 Sep-11-2021, 12:35 AM
Last Post: Lou
  Installing Modules / packages Oshadha 1 1,706 Feb-05-2021, 08:04 PM
Last Post: Jeff900
  cyrillic symbols in tables in reportlab. hiroz 5 11,487 Sep-10-2020, 04:57 AM
Last Post: bradmalcom

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020