Python in Powershell, help(<module>) does not work - python

when in powershell I will import a module. (let's use sys as an example)
However when I type help(sys) it returns "'more' is not recognized as an internal or external command, operable program or batch file."
I did not even use the term 'more'. What is my issue?

i think less is missing from your system
try:
sudo apt-get install less
then restart your python and try again

Related

Cannot run the python enumerate-markdown module

I want to run the python package described here: https://github.com/A4Vision/enumerate-markdown/blob/master/README.md
First, I installed python 3.10.4, then I installed pip 22.1, then I used pip to install "enumerate markdown". My terminal shows "Successfully installed enumerate-markdown-1.0.0 mistune-2.0.4
Now I try to run the package. In the terminal I enter the exact text shown in the example:
markdown-enum inputFile.md outputFile.md
However, it shows me an error message:
'markdown-enum' is not recognized as an internal or external command, operable program or batch file.
Even if I try pointing to an actual file (e.g markdown-enum "C:\Users\test.md" outputFile.md) it gives the same error.
I thought it might be something to do with the PATH system variable but I have entered all the paths I can think of:
C:\Users\EISAM\AppData\Local\Programs\Python\Python310
C:\Users\EISAM\AppData\Local\Programs\Python\Python310\Lib
C:\Users\EISAM\AppData\Local\Programs\Python\Python310\Lib\site-packages
C:\Users\EISAM\AppData\Local\Programs\Python\Python310\Lib\site-packages\pip
C:\Users\EISAM\AppData\Local\Programs\Python\Python310\Scripts\
(After adding these paths I restarted the cmd window and tried again but still no joy)
What am I doing wrong?
Thanks

Using Espeak with os in python

When I open up my command prompt, i am able to type espeak and then the text i want to be said, however when i try to do this through my python code using os it says
'espeak' is not recognized as an internal or external command,
operable program or batch file.
import os
text = "Apples"
os.system('espeak "{}"'.format(text))
I've tinkered with the code a fair amount but there is not much to tinker
try /usr/bin/espeak instead of espeak.
That works for my machine.
In order to be sure it works for your host I suggest you open a console and type
type espeak
This will output the absolute path of espeak. Copy that one into your system command

Trouble installing path for Python 3.7 on Windows 10

When I try to enter 'python' into my cmd window, I get back this error: "'python' is not recognized as an internal or external command,
operable program or batch file."
Any ideas how to get my cmd window working?
I tried going into environmental variables and adding my python path to the path system variables, however this is not working.
python
'python' is not recognized as an internal or external command,
operable program or batch file.
This might be what you are looking for
Running path can display the system path, and ensure things are configured correctly :)
Answered over here
Assuming you googled and found that (or something similar) yourself, then my guess is you're running into a different issue. For example, the semicolons in the path, especially the proper positioning of them, are very important, could your issue be that simple?
Try entering:
py
Some systems use this to function like mine. I had the same error but then I tried py and it worked. Maybe this will work for you

Why Python can not execute the cmd command 'tskill'?

In general, we can use Python to execute Windows's cmd command, for example:
os.system('ipconfig')
but I find that tskill can not be executed by Python, if I use:
os.system('tskill 8684')
to kill a process by its pid, Python will show cmd's error:
'tskill' is not recognized as an internal or external command, operable program or batch file.
but it work well if I use cmd to run the command.
As I know tskill.exe is located in C:\Windows\System32, but this path is not in Python's environment variable. It is maybe the reason, but ipconfig.exe is also in System32, it can be executed.
So why tskill can not be executed by os.system or subprocess.Popen?
I have found the root reason:
My Python is 32-bit, while My PC is Windows7 64-bit, so Python's os.system can not run tskill. If I use Python 64-bit instead, everything is OK.
Use taskkill, which can do pretty much everything as tskill
But if you want to stick to tskill.exe in your scripts/code. Please run the scripts from elevated command prompts. (Right click on cmd.exe and run it as administrator)
os.system('c:\windows\system32\tskill.exe 8684')

Can python file be executed in Command Prompt regardless the drive where you installed Python program?

if I installed Python program in my E drive not C drive, is it the necessary that I must execute python files in the same drive that I installed python program in Command Prompt?
for example, I installed Python Program in my E drive. I can only be allowed to execute python files by following command?
E:\python34\python filename.py
NOT
C:\python34\python filename.py
or
E:\others_direactory\python filename.py
so, I always need to tell computer to use Python program to execute the python.py, otherwise it will alert "XXX is not recognized as an internal or external command, operable program or batch file".
is that right?
Thanks
Yes, you always have to tell the computer to use the python executable to execute python programs. It does not matter if you install to C: or E: drive either, you just always have to start out by specifying python executable. The program you are running is just an argument passed to it.
You can make it less of a pain by doing what #jake-griffin suggested and adding the location to your system Path variable so you only have to type python instead of the whole path to it.
This post should explain how to set your environment variables.
How to add to the pythonpath in windows 7?

Categories