In Python I’m getting an error: Exception: (<type 'exceptions.AttributeError'>, AttributeError("'str' object has no attribute 'read'",), <traceback object at 0x1543ab8>) Given python code: def getEntries (self, sub): url="http://www.reddit.com/" if (sub...
I have answered a question regarding absolute imports in Python, which I thought I understood based on reading the Python 2.5 changelog and accompanying PEP. However, upon installing Python...
I’m trying to run this program import cv2 import time cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) while True: img = cv.QueryFrame(capture) cv.ShowImage("camera", img) if cv.WaitKey(10) == 27: break cv.DestroyAllWindows() But...
I need to get the latest file of a folder using python. While using the code: max(files, key = os.path.getctime) I am getting the below error: FileNotFoundError:...
This is a follow-up question to an answer I gave a few days back. Edit: it seems that the OP of that question already used the code I posted...
I was playing around in python. I used the following code in IDLE: p = [1, 2] p[1:1] = [p] print p The output was: [1, [...], 2] What...
I’m trying to install Scrapy Python framework in OSX 10.11 (El Capitan) via pip. The installation script downloads the required modules and at some point returns the following error:...
I installed Python 3.x (besides Python 2.x on Ubuntu) and slowly started to pair modules I use in Python 2.x. So I wonder, what approach should I take to...
I want to check my environment for the existence of a variable, say "FOO", in Python. For this purpose, I am using the os standard library. After reading the...
This question already has answers here: Why is “if not someobj:” better than “if someobj == None:” in Python? (9 answers) Closed 9 years ago. I’m a bit confused...