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

Python - How do you detect that a module has been loaded by custom loader?

Before Python-3.3, I detected that a module was loaded by a custom loader with hasattr(mod, '__loader__'). After Python-3.3, all modules have the __loader__ attribute regardless of being loaded by a custom loader. Python-2.7, 3.2: >>> import xml >>>…
4
votes
1 answer

Why is yield from native coroutines valid syntax

PEP-380 introduces the yield from syntax and says: yield from where is an expression evaluating to an iterable, from which an iterator is extracted. So the following are legal and make sense: yield from generators yield from…
dataCheeku
  • 41
  • 1
4
votes
1 answer

Python 3 Pexpect - spawnu issue: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 273: invalid start byte

I'm having an issue when using spawnu (UTF-8) from the Pexpect module for Python 3 during a SSH session when the remote machine responds with the following characters in the output: ÿÿÿÿ Here's the error the I received: UnicodeDecodeError: 'utf-8'…
Brian Kilo
  • 41
  • 3
4
votes
3 answers

Why does killing this subprocess raise a ProcessLookupError?

I can't understand when I need to kill subprocess. for package in server.packages: n = subprocess.Popen(['which', package], stdout=subprocess.DEVNULL) n.wait() if n.returncode != 0: n.kill() I'm getting…
beginner
  • 79
  • 1
  • 9
4
votes
1 answer

environment variables using subprocess.check_output Python

I'm trying to do some basic module setups on my server using Python. Its a bit difficult as I have no access to the internet. This is my code import sys import os from subprocess import CalledProcessError, STDOUT, check_output def…
Justin S
  • 1,409
  • 4
  • 22
  • 38
4
votes
1 answer

Trouble installing basemap on ipython

I've got IPython installed for both python3.3 and python3.4 When I tried to install basemap using conda install basemap I keep receving the two same errors saying there is a conflict. Hint: the following combinations of packages create a conflict…
user1274037
  • 395
  • 1
  • 2
  • 10
4
votes
2 answers

How do I check if a checkbox is checked or unchecked? (In QTreeWidget)

I have written the code below: from PyQt4 import QtCore, QtGui import sys class window(QtGui.QMainWindow): def __init__(self, parent=None): super(window, self).__init__(parent) self.TreeWidget = QtGui.QTreeWidget() …
Hamzah Akhtar
  • 525
  • 5
  • 13
  • 24
4
votes
3 answers

Parallel Disk I/O

I have several logfiles that I would like to read. Without loss of generality, let's say the logfile processing is done as follows: def process(infilepath): answer = 0 with open (infilepath) as infile: for line in infile: …
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
4
votes
1 answer

Python: display IFrame

I am trying a sample code that is supposed to use IPython and display a html file. Here is part of the code that is relevant to my question: from IPython.display import IFrame from IPython.core.display import display display(IFrame('myfile.html',…
TJ1
  • 7,578
  • 19
  • 76
  • 119
4
votes
4 answers

Python recognizes the function count as a name

I am viewing the Python tutorials from the Pascal institute BDFL says are the best to start and i have a very basic question While in the tutorial says: How many of each base does this sequence contains? >>> count(seq, 'a') 35 >>> count(seq,…
Codo
  • 271
  • 3
  • 10
  • 24
4
votes
4 answers

Psycopg2 fails to install on python 3 with pip issuing a fatal error

$ yum install python3 postgresql python-devel libpqxx-devel Loaded plugins: langpacks, refresh-packagekit Package python3-3.3.2-8.fc20.x86_64 already installed and latest version Package postgresql-9.3.2-2.fc20.x86_64 already installed and latest…
raratiru
  • 8,748
  • 4
  • 73
  • 113
4
votes
1 answer

Why sorted() and reversed() are built-in functions and not methods of sequences?

I'm digging into Python 3.3 now and I wonder why some functions (for example, sorted(), reversed()) for managing collections/iterable are built-in but some are implemented as methods of collection objects? I can append item to list using method…
artvolk
  • 9,448
  • 11
  • 56
  • 85
4
votes
2 answers

create PDF with django using python 3

I want to creat a pdf file with django. But I use python 3. Is there already a libary supportign python3? I found reportlab, pisa, html2py... but I think none support python 3. I hope something like html2py is available.
spitzbuaamy
  • 751
  • 2
  • 10
  • 25
4
votes
0 answers

Why can't Python3.3 find apt_pkg module?

Getting frustrated here because I can't seem to get things right here: I want to use python3.3 (on Ubuntu12.04) and am having major issues getting things to work. I was working fine with python3.2 until I wanted to use Bottle+Jinja2, so I had to…
dwanderson
  • 2,775
  • 2
  • 25
  • 40
4
votes
3 answers

How can I unpickle a subclass of 'dict' that validates with __setitem__ in python3?

I'm using python3.3. It's possible this problem doesn't exist in 2.x's pickle protocol, but I haven't actually verified. Suppose I've created a dict subclass that counts every time a key is updated. Something like this: class Foo(dict): def…
Christopher
  • 42,720
  • 11
  • 81
  • 99