3
votes
1answer
24 views
Threading/Multiprocessing in Python
I have the following code:
import SimpleHTTPServer
import SocketServer
def http_server():
PORT = 80
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = ...
0
votes
1answer
22 views
Python Class that Never Throws an AttributeError or TypeError
What is the best way to implement a class that never throws an AttributeError or TypeError?
The idea is that I have a class like this
class A():
def __init__(self):
self.logger = ...
1
vote
0answers
22 views
How to terminate the running function in Python Shell?
I thought this is an easy task but I googled around and had no clue at all.
I'm trying to run the pyhook tutorial and once I get to pythoncom.PumpMessages(), the function will stay idle and wait for ...
1
vote
0answers
8 views
How to store an image as a Bytes field in cassandra database using cql engine?
I want to store my website images in cassandra database! I must read and store bytes of image. Do you have a nice code for me? I'm using python2.7, django framework and cql-engine!
This is my code:
...
0
votes
3answers
35 views
Ignore the items in the ignore list by name in python
I would like to ignore all the items in a ignore_list by name in python. For example consider
fruit_list = ["apple", "mango", "strawberry", "cherry", "peach","peach pie"]
allergy_list = ["cherry", ...
3
votes
3answers
31 views
Changing a value in one list changes the values in another list with a different memory ID
I have been beating my head against a wall over this problem. I create a list and make 4 copies, only one of which shares the same memory index. If I change the original list, is somehow changes 3 of ...
0
votes
1answer
13 views
sys module giving different output when running Python script through IDLE and by double-clicking the script
I was trying to get the Python directory for executing some scripts there. I found an odd behavior.
This is just a sample code for pointing out the specific problem. I will place this path into a ...
1
vote
1answer
15 views
Python & Oneiric 11.10 issue: ImportError: No module
I installed python 2.7.5 using make install not altinstall
Previously it was 2.7.2+
now when i run python it gives
ImportError: cannot import name MAXREPEAT
I know there are already entries ...
0
votes
1answer
36 views
Is there anyway to make a localized python version?
The problem that I have right now is that I require a specific version of python in order for the source code that I have to work. To make this source code more accessible to everyone, I don't want ...
0
votes
1answer
15 views
Changing the file name of a Sqlite3 database connection, while keeping keeping entire data
I have something like....:
conn = sqlite3.connect(db_path)
...
...
conn.close()
My db_path could be ":memory:" or a real path, so how would I change it to say "newFile.db"
while keeping all of my ...
2
votes
2answers
72 views
Value Error : invalid literal for int() with base 10: ''
I'm new in Python and I don't know why I'm getting this error sometimes.
This is the code:
import random
sorteio = []
urna = open("urna.txt")
y = 1
while y <= 50:
sort = int(random.random() ...
1
vote
2answers
50 views
Whats the python equivalent of a `while read … do; … done < file` for tab delimited file?
I'm in the process of converting BASH scripts I've written into python (my BASH chops put me in a minority where I'm working).
I've got a BASH while read function loop that opens a file and formats ...
0
votes
3answers
26 views
Editing a duplicate list edits the original
So I've started a simple sort of roguelike game project in python, but I have problems with editing a duplicate list editing the original. The code is as follows:
charx = 1
chary = 1
level = ...
0
votes
0answers
16 views
Python ctypes segmentation fault when rootfs is read-only and /tmp is noexec
I'm trying to use Python for an embedded app on an Arm processor running Linux (CPython 2.7.3 cross-compiled from X86/Linux). It worked really well until I started securing the device to prevent ...
0
votes
0answers
10 views
Assigning Google Calendar Resources access rights via API
I am working to create several Google Calendar Resources using the Google Apps Calendar Resource API. I have successfully created these resources, but would like to assign access programmatically as ...