Questions tagged [python-3.3]

For issues that are specific to Python 3.3. Use the more generic [python] and [python-3.x] tags where possible.

Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use.

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.

Python 3.3 was released on September 29, 2012, and has a number of new features:

Syntax:

  • The yield from expression for generator delegation is introduced.
  • The u'unicode' syntax (which disappeared in Python 3.0) returns.

New standard library modules:

  • faulthandler - helps debugging low-level crashes.
  • ipaddress - high-level objects representing IP addresses and masks.
  • lzma - compress data using the XZ / LZMA algorithm.
  • unittest.mock - replace parts of your system under test with mock objects.
  • venv - Python virtual environments, as in the popular virtualenv package.

... as well as a reworked I/O exception hierarchy, rewritten import machinery based on importlib, more compact unicode strings, and more compact attribute dictionaries.

The C Accelerator for the decimal module has also been significantly improved, as has the unicode handling in the email module.

Finally, for security reasons, hash randomization is now switched on by default.

1148 questions
36
votes
3 answers

Format time string in Python 3.3

I am trying to get current local time as a string in the format: year-month-day hour:mins:seconds. Which I will use for logging. By my reading of the documentation I can do this by: import time '{0:%Y-%m-%d…
markmnl
  • 11,116
  • 8
  • 73
  • 109
36
votes
2 answers

whats the difference between python 3.3 and 3.3m

What's the difference between python 3.3 and 3.3m I'm using Ubuntu 13.04 Raring and on my system I have python2.7 and python3.3 (I know the differences between 2 and 3) But I also have installed python3.3m (and it's not a symlink to 3.3). So what…
willix
  • 686
  • 1
  • 6
  • 13
35
votes
6 answers

Can't catch mocked exception because it doesn't inherit BaseException

I'm working on a project that involves connecting to a remote server, waiting for a response, and then performing actions based on that response. We catch a couple of different exceptions, and behave differently depending on which exception is…
Dan Oberlam
  • 2,435
  • 9
  • 36
  • 54
35
votes
12 answers

Can't use chrome driver for Selenium

I'm having trouble using the Chrome driver for Selenium. I have the chromedriver downloaded and saved to C:\Chrome: driver = webdriver.Chrome(executable_path="C:/Chrome/") Using that gives me the following error: Traceback (most recent call last): …
user2540748
35
votes
1 answer

python: Is there a downside to using faulthandler?

Python 3.3 includes a module named faulthandler that displays helpful traceback information if a segfault occurs. (For Python versions prior to 3.3, the module can be obtained from PyPI.) The module is not enabled by default. It is enabled like…
Stuart Berg
  • 17,026
  • 12
  • 67
  • 99
35
votes
3 answers

Is python package virtualenv necessary when I use python 3.3?

I was looking in Cristoph Gohlke's python packages and I noticed that there is a package Virtualenv for Python 3.3. Since there is a package venv in the standard python library v3.3, I was wondering if there is an advantage to install this package…
aristotelis
  • 353
  • 3
  • 6
33
votes
4 answers

Non-blocking multiprocessing.connection.Listener?

I use multiprocessing.connection.Listener for communication between processes, and it works as a charm for me. Now i would really love my mainloop to do something else between commands from client. Unfortunately listener.accept() blocks execution…
33
votes
4 answers

Getting exception details in Python

I have to open & write to about 10 different files all within the same loop. e.g: for i in range(0,10): try: a=5 file1 = open("file1.txt",'w+') file2 = open("file2.txt",'w+') #... etc …
user891876
  • 503
  • 1
  • 5
  • 16
31
votes
3 answers

itertools.accumulate() versus functools.reduce()

In Python 3.3, itertools.accumulate(), which normally repeatedly applies an addition operation to the supplied iterable, can now take a function argument as a parameter; this means it now overlaps with functools.reduce(). With a cursory look, the…
JAB
  • 20,783
  • 6
  • 71
  • 80
30
votes
0 answers

Does pyvenv replace virtualenv in python3.3 +?

I just read about pyvenv which is included in Python 3.3 per PEP 405. It looks like it provides the same directory structure and the same usage as virtualenv. Is there some difference I'm missing or starting with Python 3.3, does pyvenv replace…
dm03514
  • 54,664
  • 18
  • 108
  • 145
27
votes
5 answers

Printing subscript in python

In Python 3.3, is there any way to make a part of text in a string subscript when printed? e.g. H₂ (H and then a subscript 2)
samrobbins
  • 451
  • 2
  • 6
  • 11
25
votes
5 answers

In Python 3.x make print work like in Python 2 (as statement)

I wonder if the print function can be made work (without changing the syntax all over the place) like in Python 2 and earlier. So I have the statement like: print "Hello, World!" And I like that syntax to work in Python 3. I've tried importing the…
paul23
  • 8,799
  • 12
  • 66
  • 149
25
votes
6 answers

SyntaxError: multiple statements found while compiling a single statement

I'm in Python 3.3 and I'm only entering these 3 lines: import sklearn as sk import numpy as np import matplotlib.pyplot as plt I'm getting this error: SyntaxError: multiple statements found while compiling a single statement What could I be doing…
user3213857
  • 369
  • 1
  • 3
  • 6
25
votes
3 answers

Why do distribute and pip install to my virtualenv's ./local/bin?

I create and activate a virtualenv (venv) using Python 3.3's built-in way of doing it: $ python3.3 -m venv env $ source env/bin/activate At this point python is the python in my virtualenv, which I expect: (env) $ which…
Frank T
  • 8,268
  • 8
  • 50
  • 67
23
votes
6 answers

ImportError: No module named '_sqlite3' in python3.3

sqlite3 error import sqlite3 Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.3/sqlite3/__init__.py", line 23, in from sqlite3.dbapi2 import * File…
Droid
  • 1,410
  • 8
  • 23
  • 37
1
2
3
76 77