0
votes
1answer
17 views

Clipboard is not set after application exits?

With this example from How do I copy a string to the clipboard on Windows using Python? : from tkinter import Tk r = Tk() r.withdraw() r.clipboard_clear() r.clipboard_append('i can has clipboardz?') ...
1
vote
1answer
25 views

Align numbers about python 3.3

Kilograms Pounds 1 2.2 3 6.6 … … 197 433.4 199 437.8 l want to show like Align numbers that the Kilograms of the s align 1 3 and ...
-5
votes
2answers
30 views

Percentage of similarity between 2 images [on hold]

I want to make a Python program that basically takes 2 .jpg files and compares them, and as a result it would return a percentage of similarity. For example, I take a picture of myself at the beach, ...
0
votes
1answer
26 views

How do I install psycopg2 for Python 3.x?

Just started Python a few days ago and I'm using PyCharm to develop a web application with Django. I have libpq-dev python-dev packages already installed, but it's still throwing me the same error: ...
-1
votes
0answers
33 views

Encoding situation with Python and AJAX

I have a website that require to send information on UTF-8 but when i upload to the server that is on Python3 using mod_wsgi, the information via AJAX it replace for example the unicode characters if ...
-1
votes
1answer
19 views

turtle.ontimer() equivalent for tkinter

I am writing a program that requires the tkinter canvas to update graphics. In its previous form it was written in turtle. The turtle function to update the canvas is turtle.ontimer() Is there a ...
0
votes
0answers
54 views

Python Requests Login not working

I am trying to login to this website: https://www.fotocommunity.de/login My Python script looks like this: import requests payload = { 'login[login]': 'myUser', 'login[pass]': 'myPassword', ...
0
votes
3answers
74 views

Decimal formatting based on number of digits in integer and decimal parts

What is the simplest way to format decimal depending on the number of digits in its integer and decimal parts? Lets say a user chooses to see 4 digits, then I have this test case: [('11111.1', ...
0
votes
1answer
29 views

django simple captcha keeps saying `invalid CAPTCHA`

I have followed the steps given by the docs, firstly , it works well ,but ,i don't know anythings wrong ,it makes an invalid Captcha. i run the manage.py test captcha, it says like this : ...
0
votes
1answer
47 views

Python program not printing text file

I'm working through the "Learn python the hard way" book, I've run into a problem in the Second Exercise of the 16th study drill. I am using the newest version of python 3. The code I wrote looks ...
1
vote
1answer
17 views

Tkinter: Instatiate Object with Button

I am messing around with tkinter in Python 3.3 and was wondering how would I go about using/creating an object with a button. I have the following code: from tkinter import * class Person: def ...
0
votes
1answer
35 views

How to get wave file properties using Python3 on Win32 environment?

1st I tried this: import wave #read wave file I'm trying to open def getWaveInfo(): try: #get the list of wave file attributes im interested in (channels, famerate, frames number...) ...
0
votes
2answers
37 views

Adding elements to a list in Python 3.3 by extracting consecutive elements from two other lists

This is only my second day of learning Python 3.3 so I admit I have a lot to learn. In short, I have two lists: List1 is full of odd numbers, List2 is full of even numbers. They are the same length ...
1
vote
2answers
21 views

Recommended architecture for telnet-like server (multiprocess? process pools?)

I'm writing a Python server for a telnet-like protocol. Clients connect and authenticate a session, and then issue a series of commands that each have a response. The sessions have state, in the ...
-3
votes
1answer
41 views

How to pick an index of my list element in python? [on hold]

lista=[] brojeva = int(input("Koliko želite imati elementata u listi?")) for item in range(0,brojeva): broj = int(input("Unesite broj: ")) lista.append(broj) <-- ineks_broja = ...
2
votes
2answers
52 views

python different length for same unicode

I found something really weird about unicode, in my understanding, if I u"" + "string", the type will be unicode, but why are their length different? print len(u''+'New York\u200b') 14 print ...
0
votes
2answers
50 views

How would i make a custom error message in python

In a python program I am making, I want it to only take integers, and if it gets a string say "There has been an error in the system." instead of murmering sensless information the user will not ...
-2
votes
1answer
66 views

why this while true is not looping back

def erVal(): print("The value entered is not vaild, enter a valid value") name = input("Enter your name ") while True: erVal() if name.isalpha() is True: break does not loop back WHY?? ...
0
votes
2answers
26 views

Reading a block of text from a txt file in python between two identical strings

self.viewerData = [] tempViewerData = [] tempViewer = [] started = False with open("tittardata.txt", "r") as fp: for i, line in enumerate(fp.readlines()): if ...
0
votes
2answers
26 views

imp.get_suffixes() is deprecated,how to repair it?

I have encountered : pywintypes.py:39: DeprecationWarning: imp.get_suffixes() is deprecated; use the constants defined on importlib.machinery instead but i don't know how to repair it ? could any ...
2
votes
1answer
60 views

Why doesn't python3 care about non-ascii characters in source file?

Suppose I have a .py file with the following contents print('(ノಠ益ಠ)ノ彡┻━┻') When called by python3 it prints the angry guy flipping a table, however on python2 we get SyntaxError and need to add a ...
0
votes
0answers
7 views

Updated Python Wrapper for Box2D

I am looking for a Python 3.3 wrapper for Box2D, but would be open to other suggestions for physics engines, as the only Python 3.x wrapper for Box2D that I have found was this, which seems not ...
1
vote
4answers
41 views

How to get the last item of the dictionary when looping

I know dictionaries differ from list and the "last" item is not meaningful in dictionary context. But I have a loop which iterates over a dictionary based on the user input, and then if the user input ...
3
votes
1answer
36 views

How does ThreadPoolExecutor().map differ from ThreadPoolExecutor().submit?

I was just very confused by some code that I wrote. I was surprised to discover that: with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor: results = list(executor.map(f, ...
1
vote
0answers
19 views

tkinter window not coming up while using python 3.3.3 32 bit but works fine on 64 bit

If i run the script directly(using python command), it works both on 32 as well as 64 bit python 3.3.3 installation. But my task is to integrate(As Addin/Extension) it to Enterprise Architect and ...
6
votes
4answers
93 views

Implementation of NoneType, Reasons and Details

I recently read somewhere that the special value None in python is a singleton object of its own class, specifically NoneType. This explained a lot, since most errors involving None in python produce ...
0
votes
1answer
23 views

How to Install BeautifulSoup4 Python 3.3 Mac

Is there a way to install beautifulsoup4 for python 3.3? pip install beautifulsoup4, easy_install beautifulsoup4, and python setup.py install for beautifulsoup all only install it for python 2.7. When ...
0
votes
1answer
16 views

Tkinter with Python 3.3 : Change colour of button on click

So I have been playing with tkinter to try add a gui to a lift simulator project I have written for university. It is not really needed, but I would like to add it. Here is the code that I currently ...
0
votes
1answer
43 views

Numpad not working in pygame

I need to enter numbers through a numeric usb keyboard into a box in a pygame script. If I use the normal keyboard I can enter the numbers in upper zone of the keyboard. If I try to use the numpad I ...
0
votes
2answers
40 views

Error for x in range: TypeError: 'type' object is not iterable

I'm trying to run a program in which the user types two words and I have to find the last letter of that word. After that, I have to find out if that letter is in the second word. I started of like ...
-5
votes
0answers
42 views

Removing integers that have zeroes from a list [on hold]

I have a list with random numbers, and I want to remove numbers that have zeroes (like 50123) how do I do that?
2
votes
4answers
62 views

adding ranges in python

I have the following code: for inc in range(0, ninc+1)+range(ninc-1,-1,-1): But it gives me such an error: for inc in range(0, ninc+1)+range(ninc-1,-1,-1): TypeError: unsupported operand type(s) ...
6
votes
1answer
88 views

Concurrent.futures vs Multiprocessing in Python 3

Python 3.2 introduced Concurrent Futures, which appear to be some advanced combination of the older threading and multiprocessing modules. What are the advantages and disadvantages of using this for ...
1
vote
1answer
47 views

PyQt5 failing import of QtGui

I've just moved from PyQt4 to 5 and I'm having an issue with QtGui. I installed using the 32bit windows installer, not my own build. when I do: from PyQt5 import QtGui I get class ...
0
votes
3answers
61 views

downloading a file from HTTPS website and save it

Basically i need a program that given a URL, it downloads a file and saves it. I know this should be easy but there are a couple of drawbacks here... First, it is part of a tool I'm building at work, ...
2
votes
1answer
74 views

Why is my implementation of the fourth-order Runge-Kutta method not working?

After searching in this site and on my reference book, I found out I have no idea why my code is not working. I made a fourth-order Runge-Kutta implementation for the mass-spring system (with ...
8
votes
1answer
278 views

Finding which packages support Python 3.x vs 2.7.x

Are there any methods for automatically finding which Python versions are supported by packages on PIP? I am looking for something that generates a table like the one below obtained automatically ...
1
vote
1answer
45 views

NameError on imported class

How to get rid of this NameError? main.py from com.domain.model import Employee e1 = Employee("") model.py class Person(object): def __init__(self,fname): setfname(fname) def ...
2
votes
3answers
890 views

Get: TypeError: 'dict_values' object does not support indexing when using python 3.2.3

I need help on this one: This is my code: {names[i]:d.values()[i] for i in range(len(names))} This works completely fine when using python 2.7.3; however, when I use python 3.2.3, I get an error ...
2
votes
2answers
510 views

Normalizing Unicode

Is there a standard way, in Python, to "normalize" - so to speak - a unicode string, so that it only comprehends the simplest unicode entities that can be used to represent it ? I mean, something ...
2
votes
3answers
4k views

Python's “open()” throws different errors for “file not found” - how to handle both exceptions?

I have a script where a user is prompted to type a filename (of a file that is to be opened), and if the file doesn't exist in the current directory, the user is prompted again. Here is the short ...
0
votes
2answers
212 views

Why is PyObject_Print crashing?

I've been playing with the Python 3.3 C-API to see if I could possibly use it in a planned upcoming project, and almost immediately ran into problems. Even code this simple crashes with 0xc0000005 as ...
0
votes
4answers
176 views

String input validation for a letter followed by a number [closed]

I want the userinput to be in the format letter number. The letters should be from A-H and the numbers should be in between 1-7 For exampel A4 or H7. I don't want the the userinput to be for example ...
0
votes
3answers
237 views

Getting a single list from a 2D list in Python 3.x?

Having some difficulty here. My goal is to read numbers from a column in a gameboard and print these numbers out as a specific list. I don't have much experience with lists and neither do I grasp the ...
4
votes
1answer
2k views

Unable to install boto in python3

I am trying to install boto from the source code / pypi, but I am unable to install it using python 3.2. Why is it failing? c:\boto>..\Python32\python.exe setup.py install Traceback (most recent ...
39
votes
3answers
6k views

What is the python3 equivalent of “python -m SimpleHTTPServer”

What is the python3 equivalent of python -m SimpleHTTPServer?
10
votes
2answers
8k views

How to make unicode string with python3

I used this : u = unicode(text, 'utf-8') But getting error with Python 3 (or... maybe I just forgot to include something) : NameError: global name 'unicode' is not defined Thank you.
29
votes
2answers
17k views

Deep copy of a dict in python

I would like to make a deep copy of a dict in python. Unfortunately the .deepcopy() method doesn't exist for the dict. How do I do that? >>> my_dict = {'a': [1, 2, 3], 'b': [4, 5, 6]} ...
15
votes
2answers
11k views

ctypes - Beginner

I have the task of "wrapping" a c library into a python class. The docs are incredibly vague on this matter. It seems they expect only advanced python users would implement ctypes. Well i'm a ...
22
votes
5answers
25k views

how to copy a dictionary in python 3.1 and edit ONLY the copy

can someone please explain this to me??? this doesn't make any sense to me.... I copy a dictionary into another and edit the second and both are changed???? ActivePython 3.1.0.1 (ActiveState ...

15 30 50 per page