Forums

Programming Advice

Sort:
Christopher_Parsons

I uninstalled MVS and found this video. I am going to follow the steps. It appears that it is what I want.

https://www.youtube.com/watch?v=WTOVVeAD_-M

Christopher_Parsons

null

Can anyone help me figure this out ?

stephen_33

Christopher, do you still need help or have you solved your problem?

I've been using Python 3x for a few years & find it excellent. One aspect of Python I haven't seen the other guys comment on is the amount of online support. I had a problem a while back with inputting text encoded in UTF8 & struggled trying to solve it myself before I had the bright idea of searching for a solution. Within a couple of minutes I'd fixed my problem (StackOverflow is a good place to go for advice).

You'll get a number of replies for any search you do because Python is so popular now as a general purpose object-oriented language. I use it for laborious functions such as assembling web posts for this site that contain masses of links. Also for presenting analysis of engine-checked games.

And RUNning a Python script is as simple as pressing f5 but you need to instal it in a certain way I think. I'm working in Windows 10 but it may be different for you.

Christopher_Parsons
stephen_33 wrote:

Christopher, do you still need help or have you solved your problem?

I've been using Python 3x for a few years & find it excellent. One aspect of Python I haven't seen the other guys comment on is the amount of online support. I had a problem a while back with inputting text encoded in UTF8 & struggled trying to solve it myself before I had the bright idea of searching for a solution. Within a couple of minutes I'd fixed my problem (StackOverflow is a good place to go for advice).

You'll get a number of replies for any search you do because Python is so popular now as a general purpose object-oriented language. I use it for laborious functions such as assembling web posts for this site that contain masses of links. Also for presenting analysis of engine-checked games.

And RUNning a Python script is as simple as pressing f5 but you need to instal it in a certain way I think. I'm working in Windows 10 but it may be different for you.

I am still having problems. When I try to use Notepad ++ and when I try to shell execute my code, it flashes on screen and then disappears, before I can see anything.

 

I have had a nightmare of a time with getting any code editor or IDE to run with Python, allow me to enter code and then "run" it, just to make sure it is working. 

 

I am trying to get away from the artificial environment that I started in, so I can work in the actual environment a programmer would work in. 

BronsteinPawn

What IDE are you using? Netbeans gives you an option to download the IDE together with all the files and plugins needed for a language. You can try saving your code, deleting all Python stuff in your computer and starting fresh with Netbeans and its plugins. I dont know if you have already tried that. I have been following the thread in silent but I tend to forget stuff...

 

Or you can always join the Java side and get running .jar files that will work outside an IDE environment with just a click wink.png

I have never tried to setup Python on Netbeans but I have installed Java countless times and it is always super easy. Takes 5 min at most.

BronsteinPawn

Seasoned vets may think Im a total egghead for not knowing how to write Java code in a notepad and compile it and execute from the command line but I see IDEs as a financing guy sees calculators. They are tools that make our life easier. 

Christopher_Parsons
BronsteinPawn wrote:

 

  • #6511 min ago 

    What IDE are you using? Netbeans gives you an option to download the IDE together with all the files and plugins needed for a language. You can try saving your code, deleting all Python stuff in your computer and starting fresh with Netbeans and its plugins. I dont know if you have already tried that. I have been following the thread in silent but I tend to forget stuff...

     

    Or you can always join the Java side and get running .jar files that will work outside an IDE environment with just a click wink.png

    I have never tried to setup Python on Netbeans but I have installed Java countless times and it is always super easy. Takes 5 min at most.

  • #668 min ago 

    Seasoned vets may think Im a total egghead for not knowing how to write Java code in a notepad and compile it and execute from the command line but I see IDEs as a financing guy sees calculators. They are tools that make our life easier. 

     

    I had considered trying it. I still might. I have downloaded Atom and some plug ins. I just find it annoying that I have so much trouble with Notepad++ and I know a few coders who use it regularly for other languages. I tried getting some answers from a few Python forums and found the answers to be a bit vague. 

     

    As for the perception of others thinking I can't code without an IDE, it only bothers me in terms of potential employment someday. I would rather truly understand everything, even if that means learning it and doing it the hard way at first, but I feel like I need a degree in computer science, just to get started programming, so I can understand all of these quirks and glitches, so that I know how to fix the problems. 

     

    Thanks again for your advice. 

skelos

Notepad++'s Run command seems a little tricky. I just fired it up (I'd run it before) and updated it, and I have to use "py -3 "$(FULL_CURRENT_PATH)" as the "Run" command for .py scripts now, and unlike what my memory is telling me, I'm left with a console window running Python after the script exits.

Right for "Hello, world" but not so good on the Tkinter example, which pops up it's own GUI with a dismiss button.

Thus something may have changed (or I am misremembering, equally possible) in the last version or two of Notepad++ which would lead to contradictory or confusing answers in forums. sad.png

skelos

That command I did tuck away in comments in my earlier posts where I tested, but perhaps I need to set up a file association in Windows between .py and that command. I don't really grok Windows.

Christopher_Parsons

@skelos

Please forgive the quality of these screen shots. I couldn't figure out how to keep a few drop down menus stay opened, while I tried to open my snip tool and take screen shots with it. 

 

I found an alternative method of trying to run Python and it seems to work for a moment with the execute shell command and then the just as fast as the box opens, it disappears again.

 

null

null

 

stephen_33

Christopher, I don't remember you saying what OS you're using but I'll assume Windows, since it's the most common. I found downloading Python 3x very easy & I did it from the Python website.

Checking back I see that I downloaded Python 3.3, as it was then, about five years ago & the latest version is Python 3.6. I used the Windows Installer on the website itself & it did everything for me. It creates a separate folder in your root directory & places the Python application & all relevant files & sub-folders in it.

I can't remember if you said you'd downloaded the latest version but you can do it here ...

https://www.python.org/downloads/

That refers to vers. 3.6.5 which I think is the most up to date. It's years ago but from what I remember you simply click on download, step through the process & the hard work is done for you. The download  package includes a standard GUI, the Python IDLE (Integrated DeveLopment Environment) which I find very easy to get along with.

I remember being guided towards Notebook++ as well but had trouble with the download so I gave up on that. The IDLE is all you need to get started & it pays to keep it simple!

Have you downloaded that already? If not, why not give it a go & tell us how you get on ....

skelos

Yes, that might be an idea, Stephen. I've not used that IDE; I tried Notebook++ because Christopher mentioned it.

Christopher, to run a script I choose "Run" from the menu and use the command I've posted previously. There are clearly options and/or Windows settings that interact with Notepad++ that we're missing.

I'm sorry but I'm bailing again: I write any Python code on OS X with emacs, and while I've been happy to get back up to speed a little with Python I'm so much more fluent with Perl that the only things still calling me for Python are the very nice non-core Requests module and the chess module.

For Getting Things Done in the shortest time possible (and right now I don't need the chess module and two modules in perl (LWP and one of the JSON ones) suffices to match the Requests library well enough.

Good luck.

Christopher_Parsons
stephen_33 wrote:

Christopher, I don't remember you saying what OS you're using but I'll assume Windows, since it's the most common. I found downloading Python 3x very easy & I did it from the Python website.

Checking back I see that I downloaded Python 3.3, as it was then, about five years ago & the latest version is Python 3.6. I used the Windows Installer on the website itself & it did everything for me. It creates a separate folder in your root directory & places the Python application & all relevant files & sub-folders in it.

I can't remember if you said you'd downloaded the latest version but you can do it here ...

https://www.python.org/downloads/

That refers to vers. 3.6.5 which I think is the most up to date. It's years ago but from what I remember you simply click on download, step through the process & the hard work is done for you. The download  package includes a standard GUI, the Python IDLE (Integrated DeveLopment Environment) which I find very easy to get along with.

I remember being guided towards Notebook++ as well but had trouble with the download so I gave up on that. The IDLE is all you need to get started & it pays to keep it simple!

Have you downloaded that already? If not, why not give it a go & tell us how you get on ....

I have 3.6.4 and I didn't realize that there is an environment already created there. I think I am going to purge my system of python files and start over fresh with the latest version. 

 

I take that back. 

 

I did try the IDLE in 3.6.4 and I ran into the problem of not being able to simply edit anything I typed. I would have to delete it all and start over. It made me feel like the only way to use it was to type it all in notepad++ and then copy and paste, which is why I wanted to use Notepad ++ in the 1st place.

Christopher_Parsons

@stephen_33

 

null

 

null

 

BTW, I am using Windows 7 x 64 Professional

stephen_33

It looks as if you have downloaded it already. If you're working in Windows, click on the Start Menu & scroll down to the 'p' section of applications & you should see your Python folder. In Windows10, my menu looks like this ...

null

.
Click on the IDLE option & it should open a new window, something like ...

null

.
Then from the File menu click on New Window & a this should appear ...

null

.
Then you're in business! Enter a short test script to get a feel for it & when you're satisfied it's workable, either click on Run (then Run Module) or simply f5 as you mentioned before. One curious aspect I've been unable to get around is that any python script has to be saved before it can be run in Python. Any errors in your coding & you'll get a red error report - I get plenty of those.

Does anyone know why that is & is there any way of running from the script in the window?

stephen_33

BTW, if you can't save a screenshot with the Windows Snip tool, try using the Fn and Prt Sc keys together - it takes a snapshot of the screen & copies it to your pasteboard. You'll need to open an image editor to save that - Paint is great for that. Ctrl+v will paste it in & then re-size/&/or crop the image until you're happy & save to your hard drive.

Then use the image posting tool to paste it into your post here - it's a little tidier than taking photos. Sorry if I'm explaining the obvious but I don't know how much you know.

Christopher_Parsons
stephen_33 wrote:

BTW, if you can't save a screenshot with the Windows Snip tool, try using the Fn and Prt Sc keys together - it takes a snapshot of the screen & copies it to your pasteboard. You'll need to open an image editor to save that - Paint is great for that. Ctrl+v will paste it in & then re-size/&/or crop the image until you're happy & save to your hard drive.

Then use the image posting tool to paste it into your post here - it's a little tidier than taking photos. Sorry if I'm explaining the obvious but I don't know how much you know.

No, but I wondered if there were hot keys for a screen shot. I used print screen years ago for a job I had and honestly had forgotten.

 

I will give the new python a try. I will probably get to it tomorrow or the next day. I have laundry to finish up, have to get my oldest son in bed and have a doctor appointment tomorrow. 

 

Thanks again for your help

stephen_33
Christopher_Parsons wrote: 

I did try the IDLE in 3.6.4 and I ran into the problem of not being able to simply edit anything I typed. I would have to delete it all and start over. It made me feel like the only way to use it was to type it all in notepad++ and then copy and paste, which is why I wanted to use Notepad ++ in the 1st place.

Were you typing directly into the command line editor by any chance? I made that mistake when I started & it took me a while to work out that I needed to open a new window, which opens the script editor. From there you can type, edit & then run your script.

Christopher_Parsons
stephen_33 wrote:
Christopher_Parsons wrote: 

I did try the IDLE in 3.6.4 and I ran into the problem of not being able to simply edit anything I typed. I would have to delete it all and start over. It made me feel like the only way to use it was to type it all in notepad++ and then copy and paste, which is why I wanted to use Notepad ++ in the 1st place.

Were you typing directly into the command line editor by any chance? I made that mistake when I started & it took me a while to work out that I needed to open a new window, which opens the script editor. From there you can type, edit & then run your script.

I will retrace my steps and show you where I had my problems. For me, it is almost bedtime now. 

stephen_33

Good idea but I don't think you need remove the version of Python that you've already downloaded. It seems to have installed itself correctly on your PC & if you follow the steps I gave above, you should be able to get to the Python editor window at the very least.

It's that last step that isn't very intuitive & is my main criticism of the way the IDLE is designed.


"I am still having problems. When I try to use Notepad ++ and when I try to shell execute my code, it flashes on screen and then disappears, before I can see anything." - I've only just spotted that comment & I can explain what's happening there because it used to confuse me as well.

In the IDLE, when you execute (i.e. RUN) any script, all console output (i.e. to the screen) is displayed in the main shell window. However, when you run a Python script without first starting Python, a separate console window appears in which any on-screen output is displayed. You won't confuse them because this temporary window has a black background & looks a lot like the old MSDOS window & appears only for as long as your script runs.

I have one or two Python scripts pinned to my desktop that I run directly from there, without actually starting Python itself. The (black) console window opens, any results produced appear in it & at completion, it closes. That's all well & good if the ouput is written to file but when an error occurs, the error message/report flashes up in the window for a split-second before it closes & vanishes!

That's what seems to be happening to you - because you're running your script via Notebook++, it looks as if the console is closing before you have a chance to view any displayed output. That may be happening because there's an error in your script or just because it's finished running.

Here's a simple solution to stop the console closing before you want it to - include this code at the very end of any script ....

print() 
input("Strike Enter to continue...")

That will force your script to wait before it terminates & allow you plenty of time to view any results in the console window. If it's still closing too fast, you have an error that's forcing it to close.