Questions tagged [python-3.4]

The version of the Python programming language released on March 16, 2014. For issues that are specific to Python 3.4. Use the more generic [python] and [python-3.x] tags where possible.

Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability.

Python 3.4 (released on March 16, 2014), the first beta having been released on November 24, 2013) introduces a new enum module providing an enumerated type, and an improved marshal format. Other new modules include:

3.4 also includes a bundled installer for pip to standardize installation of third-party modules.


Use this tag if your question is specifically about . If your question applies to Python in general, use the tag . If your question applies to Python 3.x but not to Python 2, use the tag . If you aren't sure, tag your question and mention which version you're using in the body of your question.

2588 questions
54
votes
11 answers

Python 3.4.0 with MySQL database

I have installed Python version 3.4.0 and I would like to do a project with MySQL database. I downloaded and tried installing MySQLdb, but it wasn't successful for this version of Python. Any suggestions how could I fix this problem and install it…
Srdan Ristic
  • 3,203
  • 5
  • 18
  • 23
51
votes
11 answers

How to check if a directory contains files using Python 3

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…
Heather
  • 877
  • 1
  • 8
  • 24
50
votes
3 answers

I have python3.4 but no pip or ensurepip.. is something wrong with my python3.4 version?

I've read in multiple places that python3.4 ships with pip. My OS is Lubuntu 14.04 and the default python version is Python 2.7.6 but in /usr/bin it says I have python3.4 installed (when I run python3 -V it says I have Python 3.4.0). I made this…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
47
votes
1 answer

What unit of time does timeit return?

I don't know how to interpret the output from Python's timeit.timeit() function. My code is as follows: import timeit setup = """ import pydash list_of_objs = [ {}, {'a': 1, 'b': 2, 0: 0}, {'a': 1, 'c': 1, 'p': lambda x:…
nivix zixer
  • 1,611
  • 1
  • 13
  • 19
46
votes
16 answers

print binary tree level by level in python

I want to print my binary tree in the following manner: 10 6 12 5 7 11 13 I have written code for insertion of nodes but can't able to write for printing the tree. so please help on…
user2762315
  • 505
  • 1
  • 4
  • 7
46
votes
2 answers

How do I import from a file in the current directory in Python 3?

In python 2 I can create a module like this: parent ->module ->__init__.py (init calls 'from file import ClassName') file.py ->class ClassName(obj) And this works. In python 3 I can do the same thing from the command interpreter and it…
user5076297
45
votes
2 answers

Python 3.4 and 2.7: Cannot install numpy package for python 3.4

I am using Ubuntu 12.04 and want to use python 3.4 side by side with python 2.7. The installation of python 3.4 worked properly. However, I cannot install the numpy package for python 3 (and as a consequence I can't install scipy, pandas…
SmCaterpillar
  • 6,683
  • 7
  • 42
  • 70
44
votes
3 answers

Should 3.4 enums use UPPER_CASE_WITH_UNDERSCORES?

As the documentation says, an enumeration is a set of symbolic names (members) bound to unique, constant values. The PEP8 says that constants are usually named as UPPER_CASE, should I use this notation in Python 3.4 enums? If yes, why the examples…
cdonts
  • 9,304
  • 4
  • 46
  • 72
43
votes
9 answers

Subclass `pathlib.Path` fails

I would like to enhance the class pathlib.Path but the simple example above dose not work. from pathlib import Path class PPath(Path): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) test = PPath("dir",…
projetmbc
  • 1,332
  • 11
  • 26
41
votes
1 answer

Keras not using multiple cores

Based on the famous check_blas.py script, I wrote this one to check that theano can in fact use multiple cores: import os os.environ['MKL_NUM_THREADS'] = '8' os.environ['GOTO_NUM_THREADS'] = '8' os.environ['OMP_NUM_THREADS'] =…
Herbert
  • 5,279
  • 5
  • 44
  • 69
38
votes
6 answers

Set debugger breakpoint at end of a function without return

I am debugging method f() that has no return in it. class A(object): def __init__(self): self.X = [] def f(self): for i in range(10): self.X.append(i) I need to see how this method modifies…
user
  • 5,370
  • 8
  • 47
  • 75
35
votes
4 answers

normalize non-existing path using pathlib only

python has recently added the pathlib module (which i like a lot!). there is just one thing i'm struggling with: is it possible to normalize a path to a file or directory that does not exist? i can do that perfectly well with os.path.normpath. but…
hiro protagonist
  • 44,693
  • 14
  • 86
  • 111
35
votes
4 answers

Hide some maybe-no-member Pylint errors

The following Python fragment code gets analyzed by Pylint: if type(result) is array.array: read = result.tobytes() ... with the following error for the last line: E:401,22: Instance of 'int' has no 'tobytes' member\ (but some types could not…
Liviu
  • 1,859
  • 2
  • 22
  • 48
35
votes
13 answers

Solving install issues with Python 3.4 on Windows

I have recently tried to install Python 3.4 as an alternative installation on my system in an attempt to familiarise myself before migrating code. My main Python installation is 2.7.6. I tried the 64 bit installer for Windows, but it came up with an…
ChrisProsser
  • 12,598
  • 6
  • 35
  • 44
34
votes
3 answers

lxml.etree.XML ValueError for Unicode string

I'm transforming an xml document with xslt. While doing it with python3 I had this following error. But I don't have any errors with python2 -> % python3 cstm/artefact.py Traceback (most recent call last): File "cstm/artefact.py", line 98, in…
Papouche Guinslyzinho
  • 5,277
  • 14
  • 58
  • 101