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

indentation error with python 3.3 when python2.7 works well

I wrote this script below which converts number to it's spelling. no = raw_input("Enter a number: ") strcheck = str(no) try: val = int(no) except ValueError: print("sayi degil") raise SystemExit lencheck = str(no) if len(lencheck) >…
cankemik
  • 516
  • 3
  • 6
  • 19
5
votes
1 answer

Python - Understaning CSV Module and line_num object

In my code, I would like to be able to print the line number if an error is found during processing (called in another piece of code), but I'm having trouble doing this using the line_num object. Here is my code for a .csv that is 4 rows long: with…
Seth
  • 61
  • 1
  • 1
  • 4
5
votes
1 answer

KeyError when using hex, octal, or binary integer as argument index with Python's str.format() method

Simple use of Python's str.format() method: >>> '{0}'.format('zero') 'zero' Hex, octal, and binary literals do not work: >>> '{0x0}'.format('zero') KeyError: '0x0' >>> '{0o0}'.format('zero') KeyError: '0o0' >>> '{0b0}'.format('zero') KeyError:…
davidchambers
  • 23,918
  • 16
  • 76
  • 105
5
votes
3 answers

Blender material from URL

I need a python script which gets a dynamically created image file from given URL and create a material with that image file. Then I will apply that material to my blender object. The python code below works for local image files import bpy, os def…
effe
  • 1,335
  • 3
  • 17
  • 26
5
votes
2 answers

Set an icon for a .exe file

I've made a .exe file of a game I made in Python, but I'm not sure how to make that exe file have an icon, because it looks dull and boring. I want to somehow make the icon be a picture of an asteroid let's say, because I made the game asteroids. I…
Infamouslyuseless
  • 922
  • 2
  • 8
  • 15
5
votes
2 answers

Segmentation fault: 11 when importing math into Python

It crashes everytime I try to import from math. Is there a way to reinstall the math library? I'm on Python 3.3.2. sidwyn$ python3 >>> from math import pi Segmentation fault: 11
Sidwyn Koh
  • 1,742
  • 2
  • 21
  • 29
5
votes
1 answer

How to pass a sqlite Connection Object through multiprocessing

I'm testing out how multiprocessing works and would like an explanation why I'm getting this exception and if it is even possible to pass the sqlite3 Connection Object this way: import sqlite3 from multiprocessing import Queue, Process def…
5
votes
4 answers

Catching a jira-python exception

I am trying to handle jira-python exception but my try, except does not seem to catch it. I also need to add more lines in order to be able to post this. So there they are, the lines. try: new_issue = jira.create_issue(fields=issue_dict) …
arynhard
  • 542
  • 1
  • 5
  • 11
5
votes
1 answer

When is sys.stdin None in Python?

I'm trying to run Flask as a simple CGI app through IIS. I have the following code: from wsgiref.handlers import CGIHandler from flask import Flask app = Flask(__name__) @app.route('/') def main(): return 'Woo woo!' CGIHandler().run(app) I'm…
Wayne Werner
  • 49,299
  • 29
  • 200
  • 290
5
votes
4 answers

Run a specific batch command in python

What if I want to include a single batch command that isn't already in a file in python? for instance: REN *.TXT *.BAT Could I put that in a python file somehow?
user2072826
  • 528
  • 1
  • 5
  • 12
5
votes
1 answer

I have installed a python library but dreampie won't import it

I have installed a python library in python3.3. When I run the interpreter in Dreampie, it can't find my newly-installed library, resulting in an error like: >>> from bs4 import BeautifulSoup Traceback (most recent call last): File "",…
jnnnnn
  • 3,889
  • 32
  • 37
5
votes
2 answers

template lookup issues. What am i not understanding?

Background: I have the following directory structure: /absolute/path/to/templates components/ component1.mak component2.mak template1.mak The plan is for the templates in the template…
Sheena
  • 15,590
  • 14
  • 75
  • 113
5
votes
4 answers

Python except for UnicodeError?

In my code I keep getting this error... UnicodeEncodeError: 'charmap' codec can't encode character '\u2013' in position 390: character maps to I tried to put an except for UnicodeError and UnicodeEncodeError but nothing works, the…
TrevorPeyton
  • 629
  • 3
  • 10
  • 22
5
votes
2 answers

Installing distribute in Python 3.3 venv (OS X/Homebrew)

I've been trying to get up and running with the built-in "venv" module of Python 3.3 on my OS X machine. I've installed Python 3.3 using Homebrew. As per the docs, creating and switching virtual environment works as you'd expect: $ python3 -m venv…
vicvicvic
  • 6,025
  • 4
  • 38
  • 55
5
votes
1 answer

Why does installing numpy using pip fail, while building directly does not?

I'm trying to install numpy under Python 3.3.0 running Mac OS 10.7.5 (Lion) and using the compilers that come with Xcode 4.5.1. I installed Python 3 and gfortran using homebrew without any hiccups, but pip3 install numpy fails. Looking at other…
DGrady
  • 1,065
  • 1
  • 13
  • 23