I am trying to read binary data from sys.stdin using Python 2.7 on Windows XP. The binary data is a WAV file decoded by foobar2000. Normally, this data is sent to a command-line encoder such as lame.exe on stdin, where it is processed and written to an output file whose name is provided in the command-line arguments. I am trying to inter...
I know that there's a function called id so I wouldn't create a function or a variable called id, but what about an attribute on an object?
...
Hello,
I have this table:
channel_items = Table(
"channel_items",
metadata,
Column("channel_id", Integer, ForeignKey("channels.id")),
Column("media_item_id", Integer, ForeignKey("media_items.id"))
)
class Channel(rdb.Model):
"""Set up channels table in the database"""
rdb.metadata(metadata)
...
Hello,
Is there a way of uploading an image file using python ?. Im able to upload files from a simple html page consisting of the code below.But i would like to be able to do that from a python program. Can it be done using urllib2 module ?. Any example i can refer to ?
Please help.
Thank You.
<form action="http://somesite.com/handle...
i want all combinations words of string "my first program"
...
I have a simple python script that just takes in a filename, and spits out a modified version of that file. I would like to redirect stdout (using '>' from the command line) so that I can use my script to overwrite a file with my modifications, e.g. python myScript.py test.txt > test.txt
When I do this, the resulting test.txt does not c...
Possible Duplicate:
Favorite 3rd-party Python Libraries?
there is a question Favorite 3rd-party Python Libraries?
i don't want know about favorite libraries, i want know a list of essential libraries.
what libraries that every python programmer should know?
...
I'm getting a bit of a headache trying to figure out how to organise modules and classes together. Coming from C++, I'm used to classes encapsulating all the data and methods required to process that data. In python there are modules however and from code I have looked at, some people have a lot of loose functions stored in modules, wh...
I am writing a native function that will return multiple python objects
PyObject *V = PyList_New(0);
PyObject *E = PyList_New(0);
PyObject *F = PyList_New(0);
return Py_BuildValue("ooo", V, E, F);
This compiles fine, however, when I call it from python, I get an error\
SystemError: bad format char passed to Py_BuildValue
How can t...
I followed the instrunction on this site http://paltman.com/2007/nov/15/getting-ssl-support-in-python-251/ to install openssl.
When I go to test i get this as the output:
test_rude_shutdown ...
test_basic ...
Segmentation fault
How would I resolve this?
...
I have a list of sub-lists of letters, where the number of letters in each sub-list can vary. The list and sub-lists are ordered. This structure can be used to produce words by choosing a number X, taking a letter from position X in every sub-list and concatenating them in order. If the number X is larger than the length of the sub-list,...
I'm looking for an elegant way, without a ton of dependencies as in some of the solutions I googled up.
Thanks for any ideas.
...
Hello,
I am trying to upload an image file to piczasso.com from python. My code is as follows:
import urllib,urllib2
url='http://piczasso.com/api_handler.php'
values = { 'data':open('./imagefile.jpg'),
'tags':'',
'size':'None'
}
data = urllib.urlencode(values)
req = urllib2.Request(url,data)
try:
respons...
I can't figure this out.
Here's what I want to happen ...
I have an applications that users upload files to S3 using boto and django. I want those files to be private and only accessible through my app using my api credentials.
So if a user uploads a photo via my app, the only way he or anyone else can download it is via his accoun...
hey guys, when i run:
with open('file00.txt') as f00:
for line in f00:
farr=array.append(float(line))
print "farr= ",farr
i get:
farr=array.append(float(line))
AttributeError: 'module' object has no attribute 'append'
does anyone know why I get this? do I have to import something? am I doing it compl...
I'm trying to open a file with Python, but I'm unsure how to find the correct filename to use.
...
Hi,
I usually don't post questions on these forums, but I've searched all over the place and I haven't found anything about this issue.
I am working with structured arrays to store experimental data. I'm using titles to store information about my fields, in this case the units of measure. When I call numpy.lib.io.flatten_dtype() on my ...
I'm trying to install PyDev in Eclipse 3.6 on Windows 7.
I have Python 2.7 successfully installed. I installed PyDev through Eclipse, and restarted.
When attempting to configure Eclipse to find my installed Python, (Window -> Preferences) the list that appears does not contain Python. (See image below.)
If I go back to Help -> Ins...
I saved a file as DictionaryE.txt in a Modules folder I created within Python. Then I type:
fh = open("DictionaryE.txt")
I get this error message:
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
fh = open("DictionaryE.txt")
IOError: [Errno 2] No such file or directory: 'DictionaryE.txt'
What am I d...
Is there a way to program using pure python in Xcode? I want something like the c++ command line utility except for python, I found a tutorial that did not work for me: (after playing around with which active architecture finally decided on i386) when trying to print "Hello, World!" I get the following error "Data Formatters temporarily ...