Category "python-2.7"

TypeError: argument 1 must be pygame.Surface, not None

I am making a game similar to Galaga in a computer class I am in. I am having trouble with collisions and cannot get things to disappear without errors. I want

Turning Input into a list [duplicate]

Write a Python program which accepts a sequence of comma-separated numbers from user and generate a list and a tuple with those numbers. v

Auth failing - 999- HTTP status code is not handled or not allowed

I using scrapy, and I would like to get Ignoring response URL.I just see in the output console this: DEBUG: Ignoring response <999 https://www.mywebsite.com

How to grab values from key:value pairs in parsed JSON in Python

I am trying to extract data from a JSON file. Here is my code. import json json_file = open('test.json')

Generating ZipFile with List of StringIO Object, CRC Error when Opening the ZipFIle

I am currently facing some difficulty regarding generating Text file with multiple line of text and add it to a ZipFile in memory with Python 2.7. The code belo

What is the function in Python that sort files by extension?

import os import string os.chdir('C:\Python27') x=os.listdir('C:\Python27') y=[f for f in os.listdir(dirname) if os.path.isfile(os.path.join(dirname, f))]

How to extract text from a Specific Area in a PDF using Python?

I'm trying to extract Text from a PDF using Python, and I have successfully done so using PyPDF2 like this: from PyPDF2 import PdfFileReader reader = PdfFileRea

Latin Hypercube Sampling from a normal distribution (Python)

How to generate 10 random numbers from normal distribution using latin hypercube sampling technique in python 2.7? The range of the random number should be 5 to

no module wxPython

I am using windows 8.1, 64 bit with python 2.7, and trying to import wxPython, which I downloaded from http://www.lfd.uci.edu/~gohlke/pythonlibs/ I installed it

no module wxPython

I am using windows 8.1, 64 bit with python 2.7, and trying to import wxPython, which I downloaded from http://www.lfd.uci.edu/~gohlke/pythonlibs/ I installed it

Error installing Dlib library for python

While trying to install Dlib library for Python, using this tutorial http://dlib.net/compile.html. This tutorial says to do this - cd examples mkdir build cd

flake8 not picking up config file

I have my flake8 config file in ~/.config/flake8 [flake8] max-line-length = 100 However when I run flake8 the config file is not picked up. I know that becau

What is the return type hint of a generator function?

I'm trying to write a :rtype: type hint for a generator function. What is the type it returns? For example, say I have this functions which yields strings: d

how to get argparse to read arguments from a file with an option rather than prefix

I would like to know how to use python's argparse module to read arguments both from the command line and possibly from text files. I know of argparse's fromfil

Python Numpy: replace values in one array with corresponding values in another array

I am using Python Numpy arrays (rasters converted to 2D arrays, specifically) and what I want to do is take one array that has arbitrary dummy values of -999 re

How to display a text with matplotlib

I would like to do this : I have this python code : import numpy as np import pylab as plt a = np.array([1,2,3,4,5,6,7,8,9,10]) b = np.array([7,8,6,3,2,1,5,8,4

How can i communicate between delta plc with Ethernet support and python pymodbustcp

please help me My first test is with a Delta DVP-12SE11R PLC and the connection is with the Modbus TCP/IP protocol. I have a python code written using pymodbust

Python GUI using tkinter and db connection [duplicate]

I am not able to get any output from the following program.What i am trying to do here is store employee name and salary in a database and lat

How to convert SOAP API to REST API using python?

I have to create a python script that should hit a SOAP API and should convert that to Restful API. I have XSD and WSDL files with me. Can someone help me how t

how to add dynamically generated pdf file to zipfile Python?

z = zipfile.ZipFile("zipfile.zip", "w") z.write(filename) It takes string as an argument that is actually path of that file to be add to the zip. But I want t