Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to open Python?
#11
(Jun-17-2021, 04:36 PM)bensan Wrote: but this is the result I get "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases."

Haven't used Windows for years now and my memory is somewhat rusty in that regard. But description of your steps leave some ambiguity what you have done. You stated that: 'Downloaded Python 3.8.1.' but there is nothing about installing it. Did you install? If you installed it, is it on the path? I think that easiest way is to follow recommendation from error messsage: 'run without arguments to install from the Microsoft Store'. So if you enter just 'python' to command interpreter then it should install it from Microsoft Store and do all necessary setup automagically.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#12
(Jun-18-2021, 09:55 AM)perfringo Wrote:
(Jun-17-2021, 04:36 PM)bensan Wrote: but this is the result I get "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases."

Haven't used Windows for years now and my memory is somewhat rusty in that regard. But description of your steps leave some ambiguity what you have done. You stated that: 'Downloaded Python 3.8.1.' but there is nothing about installing it. Did you install? If you installed it, is it on the path? I think that easiest way is to follow recommendation from error messsage: 'run without arguments to install from the Microsoft Store'. So if you enter just 'python' to command interpreter then it should install it from Microsoft Store and do all necessary setup automagically.

You asked "If you installed it, is it on the path?" - I dont understand what you are asking.

Yes, it was installed in the Users folders (which had a long path) but Ive uninstalled & reinstalled it into C:/Programs/Python38-32.

Then I saved the .py file into C:/Programs/Python38-32/TextEditor.py

All of that has made no difference if I paste python /C:/Programs/Python38-32/TextEditor.py & hit enter.

Is there some other place where I should store the .py files?

I must say that Im reaching the end of my patience with Python. I keep reading "Python is easy to learn" but Im finding it the most complicated program that I have ever experienced in my 25+ years of dealing with computers, together with the fact that Im an experienced PHP developer where if I sat a test in CodeIgniter I believe I would gain a 60%-80% marking..
Reply
#13
you should create a project file for each project and perhaps store python scripts in a subdirectory of that.
If installed properly, python should be visible in any directory,

You should never put anything in the python installation directory.

the following is a typical project directory structure that I use (you probably don't need all of these directories):

Output:
├── ProjectName │ ├── data │ │ ├── csv │ │ ├── database │ │ ├── html │ │ ├── json │ │ ├── pretty │ │ └── tmp │ ├── docs │ ├── requirements.txt │ ├── src │ │ └── any.py | │ ├── ...

  1. simply change to the directory where the python file exists.
  2. open a command window
  3. to make sure python is properly installed, run command python -V
  4. run program with command: python myscript.py
Reply
#14
I can try to give some getting stated tips.
(Jun-17-2021, 04:36 PM)bensan Wrote: "Once in shell of your choice cd (change directory) ...." That is alien to me but I may understand it better after I investigate your links.
This is a little worrying as you done other stuff for a while and not learned command line better cmd tutorial .
Command line usage is very important in programming,i use cmder which is lot better,you can look at it later.

Start:
Python 3.9/3.8 and pip installation under Windows
Try follow this and eg install Python 3.9.5 and run command and code from cmd.
It's important that python and pip commands work from anywhere in cmd(Then OS Path is ok).

Editor:
Here would i suggest one that is very simple to use and also good editor.
PyScripter
[Image: t0F8Lt.png]

bensan Wrote:And why are the tutorials not describing how Python should be integrated with HTML & CSS?
There are many out there,get the basic to work first.
In Python is Flask and Django the biggest.
Flask is more similar to basic PHP programming as you close to HTML/CCS.
Have tutorial here basic setup Flask and Flask]Weather app
And very good Editor for Python(alone) or when programming with web-development
VS Code from start
Larz60+ likes this post
Reply
#15
(Jun-18-2021, 08:14 PM)Larz60+ Wrote: you should create a project file for each project and perhaps store python scripts in a subdirectory of that.
If installed properly, python should be visible in any directory,

You should never put anything in the python installation directory.

the following is a typical project directory structure that I use (you probably don't need all of these directories):

Output:
├── ProjectName │ ├── data │ │ ├── csv │ │ ├── database │ │ ├── html │ │ ├── json │ │ ├── pretty │ │ └── tmp │ ├── docs │ ├── requirements.txt │ ├── src │ │ └── any.py | │ ├── ...

  1. simply change to the directory where the python file exists.
  2. open a command window
  3. to make sure python is properly installed, run command python -V
  4. run program with command: python myscript.py

Thanks @Larz60+

I do have a directory C:/PythonProjects/TextEditor.py - But it makes no difference.

I would prefer to open in a browser. The opening of a command window is extremely frustrating & unlike web development.

If I open Python & type 6*2 + enter 12 appears.
Reply
#16
(Jun-18-2021, 09:29 PM)snippsat Wrote: I can try to give some getting stated tips.
(Jun-17-2021, 04:36 PM)bensan Wrote: "Once in shell of your choice cd (change directory) ...." That is alien to me but I may understand it better after I investigate your links.
This is a little worrying as you done other stuff for a while and not learned command line better cmd tutorial .
Command line usage is very important in programming,i use cmder which is lot better,you can look at it later.

Start:
Python 3.9/3.8 and pip installation under Windows
Try follow this and eg install Python 3.9.5 and run command and code from cmd.
It's important that python and pip commands work from anywhere in cmd(Then OS Path is ok).

Editor:
Here would i suggest one that is very simple to use and also good editor.
PyScripter
[Image: t0F8Lt.png]

bensan Wrote:And why are the tutorials not describing how Python should be integrated with HTML & CSS?
There are many out there,get the basic to work first.
In Python is Flask and Django the biggest.
Flask is more similar to basic PHP programming as you close to HTML/CCS.
Have tutorial here basic setup Flask and Flask]Weather app
And very good Editor for Python(alone) or when programming with web-development
VS Code from start

Thanks @snippsat. Ive run some testing but nothing has worked. First I rebooted, then I changed all directory names to lower case, then installed Python v3.9.5 & everything is the same. Python text editor will not open or appear.

If I enter "python" only into the Windows command + hit enter the Python command window appears. If I enter some maths it works. If I enter print("Hello World") it works. So it appears as if Python is installed correctly.

But all of that I dont want coz it is no use to me. I want to start learning on how to create a simple text editor. All the example coding Ive used does not work.

This is the last one I tried -
 https://www.geeksforgeeks.org/build-a-basic-text-editor-using-tkinter-in-python/ 
This is what I entered into the Windows command line -
 python /C:/PythonProjects/TextEditor.py 
& I also tried it in lower case.

I am using my old favorite text editor UltraEdit because Im very familiar with everything. I will consider other editors if & when UltraEdit gives a problem or there is some kind of limitation. All I want at this stage is to get a program to appear.

I prefer a program appearing in a browser as it is web application that I am doing. I do not like using a command line as that is not web development. Why is the Common Gateway Interface (CGI) standard not being used? I mentioned that subject earlier but nobody commented.

You suggested Django but that is a framework. I am already using the CodeIgniter framework & I doubt if two frameworks will work together. CodeIgniter allows for in & out of PHP & HTML & will probably allow Python in & out & back into PHP. While PHP & HTML are going in & out my system is still in CodeIgniter. I doubt if Django will allow the entry of PHP.

Another doubt I have. Will a Python text editor with a macro "select copy & paste"? If it wont do that Im probably wasting my time with Python.

I have spent the last month trying to get Python to work but achieve absolutely nothing.
Reply
#17
You seems confusing bye really basic stuff like using command line.
So in link Python 3.9/3.8 and pip installation under Windows
Have to check that installation work from anywhere in cmd,here a tutorial read and test it this time.How to use the Windows command line.

Here from start in cmd,this do now not old stuff.
Microsoft Windows [Version 10.0.19041.1052]
(c) Microsoft Corporation. Med enerett.

# Change directory down 
C:\Users\Tom>cd ..

# Change directory down 
C:\Users>cd ..

# Check Python version 
C:\>python -V
Python 3.9.5

# Check pip version
C:\>pip -V
pip 21.1.1 from c:\python39\lib\site-packages\pip (python 3.9)

C:\>
This most work then is installation ok.

So it i put this a file in a folder C:\code\,i can run it like this.
# hello.py
print('Test to run a Python file')
From cmd.
# Change directory up
C:\>cd code

# Run python file
C:\code>python hello.py
Test to run a Python file

C:\code>
bensan Wrote:Why is the Common Gateway Interface (CGI) standard not being used? I mentioned that subject earlier but nobody commented.
CGI is dead💀
Python community did now that CGI had no future so the did write a write new way in PEP 3333 -- Python Web Server Gateway
Why is WSGI necessary?

So today is all Python web-frameworks build on top of this WSGI standard,and no one use CGI.
The closets and much better way to work like did with CGI today in Python is to eg use Flask (close to HTML/CSS as was with CGI).
Reply
#18
Most do not do their development on the command line or the like. More common to use VSCode or PyCharm, both of which allow you to run the program in the IDE. You are doing it the hard way.

And, agree with others that Flask is good if you are developing for web, or if you want a GUI based app that runs in Windows then the Wx or Tkinter frameworks work.
Reply
#19
(Jun-23-2021, 05:01 PM)jefsummers Wrote: Most do not do their development on the command line or the like. More common to use VSCode or PyCharm, both of which allow you to run the program in the IDE. You are doing it the hard way.
This is not all about doing all development on the command line,
it just so bensan can do there bare minimum like checking/running python and pip work from cmd.
Then when this is ok can use a easy Editor like posted here(PyScripter) or more advance editors like VS Code/PyCharm.

There is no way that can avoid a basic command line knowledge in programming,i would say it's very important basic knowledge in programming overall.
It just amaze that he been doing lot stuff before like PHP/CodeIgniter whiteout even touch the command line.
Reply
#20
(Jun-23-2021, 02:23 PM)snippsat Wrote: You seems confusing bye really basic stuff like using command line.
So in link Python 3.9/3.8 and pip installation under Windows
Have to check that installation work from anywhere in cmd,here a tutorial read and test it this time.How to use the Windows command line.

Here from start in cmd,this do now not old stuff.
Microsoft Windows [Version 10.0.19041.1052]
(c) Microsoft Corporation. Med enerett.

# Change directory down 
C:\Users\Tom>cd ..

# Change directory down 
C:\Users>cd ..

# Check Python version 
C:\>python -V
Python 3.9.5

# Check pip version
C:\>pip -V
pip 21.1.1 from c:\python39\lib\site-packages\pip (python 3.9)

C:\>
This most work then is installation ok.

So it i put this a file in a folder C:\code\,i can run it like this.
# hello.py
print('Test to run a Python file')
From cmd.
# Change directory up
C:\>cd code

# Run python file
C:\code>python hello.py
Test to run a Python file

C:\code>
bensan Wrote:Why is the Common Gateway Interface (CGI) standard not being used? I mentioned that subject earlier but nobody commented.
CGI is dead💀
Python community did now that CGI had no future so the did write a write new way in PEP 3333 -- Python Web Server Gateway
Why is WSGI necessary?

So today is all Python web-frameworks build on top of this WSGI standard,and no one use CGI.
The closets and much better way to work like did with CGI today in Python is to eg use Flask (close to HTML/CSS as was with CGI).

Thanks @snippsat. I have read your part of the command line but quite frankly Im not very interested in that. I see that is the job of the Python developers to understand & formulate some kind of window application for web developers to follow & clearly understand. In the website that Im developing I dont expect the users to ever go into prompt command, so I do my best to make the site as user friendly as possible.

It appears as if my problem lies with WSGI or the lack of it. Is WSGI part of Python or is it something that I need to download & add to Python?

And as Flask is a framework, will it conflict with CodeIgniter, which is also a framework?

And do I need to download & install Flask?

Can you answer - Will a Python text editor with a macro "select copy & paste"?
Reply


Forum Jump:

User Panel Messages

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