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
26
votes
1 answer

how to cleanly uninstall my python packages with pip3 or any other way?

this is my setup.py file for installing my python program, after the installation using python3 setup.py install an entry to my program was created named testmain , when i did pip3 freeze it showed abc==0.1 in its output ,so i uninstalled it using…
Rajdeep Sharma
  • 463
  • 1
  • 5
  • 9
26
votes
7 answers

urllib HTTPS request:

I have a script on python3.4 and it has been fine until the website I download the file from decides to use https and now I am getting error but can't figure out how I can retrive the file. My script import the following library and uses the…
Adi Wong
  • 383
  • 1
  • 4
  • 8
26
votes
4 answers

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

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) …
Chevron
  • 364
  • 2
  • 5
  • 10
25
votes
3 answers

How can I construct an enum.Enum from a dictionary of values?

I'd like to generate some types at runtime from a config file. For simplity, let's assume I already have the data loaded as a python dictionary: color_values = dict(RED = 1, YELLOW = 2, GREEN = 3) How can I transform this into the type (using…
Eric
  • 95,302
  • 53
  • 242
  • 374
25
votes
1 answer

python import multiple times

I suppose this is a general question so sorry if not posted in the right place. Say for instance, I have a function a which imports os. If I was to call this function from another file multiple times I am assuming that the import would be done…
JONAS402
  • 591
  • 1
  • 9
  • 18
25
votes
5 answers

Auto register Django auth models using custom admin site

I implemented authentication management using Django auth with the default admin site but then I wanted to use my own AdminSite to rewrite some behaviors: class OptiAdmin(admin.AdminSite): site_title = "Optimizer site's admin" #...Other…
25
votes
1 answer

Discovering keys using h5py in python3

In python2.7, I can analyze an hdf5 files keys use $ python >>> import h5py >>> f = h5py.File('example.h5', 'r') >>> f.keys() [u'some_key'] However, in python3.4, I get something different: $ python3 -q >>> import h5py >>> f =…
user14717
  • 4,757
  • 2
  • 44
  • 68
25
votes
2 answers

Why is one class variable not defined in list comprehension but another is?

I just read the answer to this question: Accessing class variables from a list comprehension in the class definition It helps me to understand why the following code results in NameError: name 'x' is not defined: class A: x = 1 data = [0, 1,…
Lone Learner
  • 18,088
  • 20
  • 102
  • 200
24
votes
2 answers

What are __signature__ and __text_signature__ used for in Python 3.4

If one does dir() on some builtin callables (class constructors, methods, etc) on CPython 3.4, one finds out that many of them often have a special attribute called __text_signature__, for example: >>> object.__text_signature__ '()' >>>…
23
votes
6 answers

Python AES encryption without extra module

Is it possible to encrypt/decrypt data with AES without installing extra modules? I need to send/receive data from C#, which is encrypted with the System.Security.Cryptography reference. UPDATE I have tried to use PyAES, but that is too old. I…
Anton
  • 542
  • 1
  • 6
  • 16
22
votes
3 answers

isinstance fails for a type imported via package and from the same module directly

/Project |-- main.py |--/lib | |--__init__.py | |--foo.py | |--Types.py /Project/lib has been added to the PYTHONPATH variables. Types.py: class Custom(object): def __init__(self): a = 1 b = 2 foo.py: from Types import…
netik
  • 1,736
  • 4
  • 22
  • 45
22
votes
2 answers

What is the correct format to upgrade pip3 when the default pip is pip2?

I develop for both Python 2 and 3. Thus, I have to use both pip2 and pip3. When using pip3 - I receive this upgrade request (last two lines): $ pip3 install arrow Requirement already satisfied (use --upgrade to upgrade): arrow in c:\program files…
boardrider
  • 5,882
  • 7
  • 49
  • 86
22
votes
1 answer

Pandas error - invalid value encountered

I'm new to Pandas. I downloaded and installed Anaconda. Then I tried running the following code via the Spyder app: import pandas as pd import numpy as np train = pd.read_csv('/Users/Ben/Documents/Kaggle/Titanic/train.csv') train Although this…
Ben
  • 20,038
  • 30
  • 112
  • 189
22
votes
5 answers

Countdown Clock: 01:05

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…
trevor4n
  • 281
  • 1
  • 3
  • 11
21
votes
1 answer

`async for` in Python 3.4

There's a way to transform a Python 3.5 async for statement in a Python 3.4 code? PEP 0492 says that async for async for TARGET in ITER: BLOCK else: BLOCK2 is equivalent to iter = (ITER) iter = type(iter).__aiter__(iter) running =…
Marco Sulla
  • 15,299
  • 14
  • 65
  • 100