python-3.4

setting up environment in virtaulenv using python3 stuck on setuptools, pip, wheel

[亡魂溺海] 提交于 2019-11-27 15:59:13
Running the following: virtualenv -p python3 venv gives: Running virtualenv with interpreter /usr/bin/python3 Using base prefix '/usr' New python executable in /specific/a/home/cc/students/csguests/taivanbatb/venv/bin/python3 Also creating executable in /specific/a/home/cc/students/csguests/taivanbatb/venv/bin/python Installing setuptools, pip, wheel... which is where it gets stuck. Calling CTRL-C gives: File "/usr/local/bin/virtualenv", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 671, in main Traceback (most recent call last): File "

Python 3: How can object be instance of type?

喜你入骨 提交于 2019-11-27 15:08:37
In Python 3, object is an instance of type and type is also an instance of object ! How is it possible that each class is derived from the other? Any implementation details? I checked this using isinstance(sub, base) , which, according to Python documentation, checks if sub class is derived from base class: isinstance(object, type) Out[1]: True isinstance(type, object) Out[2]: True This is one of the edge cases in Python: Everything in Python is an object, so since object is the base type of everything, type (being something in Python) is an instance of object . Since object is the base type

pyttsx: No module named 'engine'

时间秒杀一切 提交于 2019-11-27 13:11:16
I'm trying to install TTS package by using this . Everything was okay until I tried to execute the following command: import pyttsx I got back this error: File "/usr/local/lib/python3.4/dist-packages/pyttsx/__init__.py", line 18, in module <br> from engine import Engine<br> ImportError: No module named 'engine' Any help would be appreciated. Thank you! Natesh bhat Guys there is an updated package compatible with Python3 : pyttsx3 Works offline with no delay in the sound produced. Installation: pip install pyttsx3 Visit https://pyttsx3.readthedocs.io for the full usage docs. Thanks! csheehey

HTTPResponse object — JSON object must be str, not 'bytes'

跟風遠走 提交于 2019-11-27 12:05:44
I've been trying to update a small Python library called libpynexmo to work with Python 3. I've been stuck on this function: def send_request_json(self, request): url = request req = urllib.request.Request(url=url) req.add_header('Accept', 'application/json') try: return json.load(urllib.request.urlopen(req)) except ValueError: return False When it gets to this, json responds with: TypeError: the JSON object must be str, not 'bytes' I read in a few places that for json.load you should pass objects (In this case an HTTPResponse object) with a .read() attached, but it doesn't work on

Countdown Clock: 01:05

落花浮王杯 提交于 2019-11-27 10:57:18
问题 How can I create a countdown clock in Python that looks like 00:00 (min & sec) which is on a line of its own. Every time it decreases by one actual second then the old timer should be replaced on its line with a new timer that is one second lower: 01:00 becomes 00:59 and it actually hits 00:00 . Here is a basic timer I started with but want to transform: def countdown(t): import time print('This window will remain open for 3 more seconds...') while t >= 0: print(t, end='...') time.sleep(1) t

How to install pip in CentOS 7?

邮差的信 提交于 2019-11-27 10:32:48
CentOS 7 EPEL now includes Python 3.4: yum install python34 However, when I try that, even though Python 3.4 installs successfully, it doesn't appear to install pip. Which is weird, because pip should be included by default with Python 3.4. which pip3 doesn't find anything, nor does which pip . How do I access pip from the Python 3.4 package in CentOS 7 EPEL release? The easiest way I've found to install pip3 (for python3.x packages) on CentOS 7 is: $ sudo yum install python34-setuptools $ sudo easy_install-3.4 pip You'll need to have the EPEL repository enabled before hand, of course. You

How to check to see if a folder contains files using python 3

人走茶凉 提交于 2019-11-27 09:11:45
I've searched everywhere for this answer but can't find it. I'm trying to come up with a script that will search for a particular subfolder then check if it contains any files and, if so, write out the path of the folder. I've gotten the subfolder search part figured out, but the checking for files is stumping me. I have found multiple suggestions for how to check if a folder is empty, and I've tried to modify the scripts to check if the folder is not empty, but I'm not getting the right results. Here is the script that has come the closest: for dirpath, dirnames, files in os.walk('.'): if os

Method for having animated movement for canvas objects python

我的梦境 提交于 2019-11-27 08:07:14
问题 I have been trying to learn how move canvas items from google, however the method shown most places doesnt seem to work for me as intended. right now i am just trying to get a ball move from one side of the screen to the other over the period of 1 second from tkinter import * root = Tk() c = Canvas(root, width = 200, height = 100) c.pack() ball = c.create_oval(0, 25, 50, 75) for i in range(25): c.move(ball, 6, 0) root.after(40) root.mainloop() when run, this seems to move the ball before

How to install this wheel?

巧了我就是萌 提交于 2019-11-27 07:07:18
问题 I managed to install pip but when I use pip to install the downloaded wheel, it prints: C:\Python34\Scripts\pip install pygame-1.9.2a0-cp34-none-win_amd64.whl Requirement 'pygame-1.9.2a0-cp34-none-win_amd64.whl' looks like a filename, but the file does not exist pygame-1.9.2a0-cp34-none-win_amd64.whl is not a supported wheel on this platform The file is in the same folder (Scripts) with pip. I did try to use the wheel tool too: C:\Python34\Scripts\wheel install pygame-1.9.2a0-cp34-none-win

ImportError: No module named 'queue' while running my app freezed with cx_freeze

限于喜欢 提交于 2019-11-27 06:55:48
问题 I am using python 3.4. I am able to run my python script without any problem. But While running my freezed python script , following error have appeared. I am able to freeze my script successfully too with cx_freeze. C:\Program Files (x86)\utils>utils.exe Traceback (most recent call last): File "C:\Python34\lib\site-packages\requests\packages\__init__.py", line 27, i n <module> from . import urllib3 File "C:\Python34\lib\site-packages\requests\packages\urllib3\__init__.py", line 8, in <module