Python crashing when I load numpy surface

I was checking out python some time ago and decided to look into it further.
I installed python3, no problems bar having to put in the variable paths.
checked that pip was installed.
I’m using win10
Python install was python 3.6.6 which is win32
pygame install was pygame-1.9.3-cp36-cp36m-win32.whl
numpy install was numpy-1.13.3-+mkl-cp36-cp36m-win32.whl
downloaded numpy and installed it from the download file C:/users/-me-/downloads
Check to make sure numby is working from command prompt.
I open up the python shell (guessing that is what you call it).
Open up pygame surface:

gameDisplay = pygame.display.set_mode((800,600))
pygame.display.set_caption('A bit Racey')

Thats it, python stops responding. I have searched for an answer for hours – Nothing
Any help appreciated as I don’t really want to delete and reinstall everything if at all possible (not again)

And I thought you were going to concentrate on HTML and CSS!

If you really want to learn Python, I would start with examples that don’t require you to install several libraries. After all from where you are you don’t know whether it’s your Python install or one or more of the libraries you’ve installed that is up the spout.

If you really must try to lean Python now, try something simpler and edit/create your program in IDLE and run it from there and you should get error messages telling you what is wrong.

Why not try the following to begin with:

num = (input("Enter a Number: "))
mod = int(num) % 2
if mod > 0:
    print("is  odd number.")
else:
    print("is even number.")
1 Like

Once I get something into my head I dont know how to stop, it drives me crazy. The idea with python is that I can use it to distract me from css for awhile (something like a holiday).

I think the library needs to be imported first.

https://www.pygame.org/docs/tut/ImportInit.html

I followed several tutorials for the install of python and pygame and numpy. They are all very much the same. I have tried everything, install python 64bit, deleted it, tried python 32bit, deleted it. Both with pygame and numpy. Then tried anaconda with pygame and numpy. Then went back to my python64bit, installed pygames64bit, numpy64bit. Now I’m going to kick the dog, abuse the cat next door, and say stuff python.

The community is useless compared to php, I’m sure its just a dll missing, but theres no support. I’ve now got folders all over the place with left overs. Waste of time. Annoying because I was hoping to get my son interested in building some games. Instead he will waste his life playing them.

Could be something as simple as an environment variable. I added one pointing to python.

Using windows with none Microsoft technologies can be an exercise in futility. You might want to try using a Linux virtual machine instead. This site provides an easy way to stand-up a vm and add packages for varying languages like python.

http://puphpet.com

I use this site to configure and stand up all my environments. The only none Microsoft tech that seems to work ok with Windows is nodejs. Everything else is flawed in my experience which is why I prefer a vm on windows and even on my mac.

First, figured out why I was having problems with pygame. Wasn’t pygame at all. Idiots write tutorials pretending they are working in command prompt. Python will not respond as it doesn’t have enough script to repond too. Hence it looks like theres a problem with the install. I spent a week installing/uninstalling.

Reason I’m not going js way is that in places like U.S and Oz they are turning off js on their smart phones because of he cost. I see this as becoming a bigger problem in the future. You can also add to that, that I find js annoying, although I don’t think any more of css with its modals.

At the end of the day I’m learning and thats whats important.

Kind of getting off topic but JavaScript can be used on the server-side with node.js and universal rendering. The internet leaders have an obvious Agenda with JavaScript and I don’t see anything getting in the way of that. Not that PHP is bad but failure to embrace the Agenda of the internet leaders is going to make for a rough future in finding work.

To keep on topic:

Any help appreciated.
This is from a tutorial, problem is the tut is for python2.7

I’m new and haven’t got my head around it yet. All I know is that it seems to work in 2.7 and I can’t get the bugs out. I have added the “import requests”, and can’t figure out this not declaring anything, well almost anything.

Here’s the real bad stuff:
Traceback (most recent call last):
File “C:\Python36-32\trash-soon\check_profanity.py”, line 22, in
read_text()
File “C:\Python36-32\trash-soon\check_profanity.py”, line 8, in read_text
check_profanity(contents_of_file)
File “C:\Python36-32\trash-soon\check_profanity.py”, line 13, in check_profanity
output = connection.read()
AttributeError: ‘Response’ object has no attribute ‘read’

import requests


def read_text():
    quotes = open(r"C:\Python36-32\trash-soon\movie_quotes.txt")
    contents_of_file = quotes.read()
    quotes.close()
    check_profanity(contents_of_file)


def check_profanity(text_to_check): 
    connection = requests.get("http://www.wdyl.com/profanity?q="+text_to_check)
    output = connection.read()
    connection.close()
    if "true" in output:
        print("profanity Alert!!")
    elif "false" in output:
        print("This document has no bad words!!")
    else:print("Couldn't open the thing!!") 


read_text()

It would help if you identified which lines are giving the error. We can only guess which is line 22, 8 and 13.

However, are you sure this is correct?

quotes = open(r"C:\Python36-32\trash-soon\movie_quotes.txt")

I’m thinking it’s probably not a good idea to follow a Python 2 tutorial if you want to learn Python 3!!!

Try this:

from six.moves.urllib.request import urlopen
link = "http://www.somesite.com/details.pl?urn=2344"
response = urlopen(link)
content = response.read()
print(content)

Google search:

1 Like

Really? That’s interesting. Have you got a link to anything that corroborates that?

2 Likes

Sorry I didn’t keep the link, or article. And I have no way of knowing if its correct or not beyond my own experience.

My daughter lives in Oz, I’ll ask her for her thoughts. Js seems to be like a V8 with 3 spark plugs taken out for economy, just sucking gas for the hell of it. Didn’t save much if anything, and gave up a lot of speed to get there.

I think you’re reading the wrong magazines!

1 Like

Shame. But thanks for the reply. I’ll not hijack the discussion at hand any further :slight_smile:

I think its an endless argument isn’t it?

Abuse is what does the damage. doesn’t matter if your talking js, css or anything else.
I’m trying to get as far away from popups and modals as I can. I would like to think I could build something constructive.

Universal rendering solves all the problems with JavaScript being turned off in browser because everything is rendered on the server via node.js. Not to mention asynchronous nature of JavaScript makes it one of most efficient languages to develop with on the web for both front and back-end development.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.