hi,
i have to crawl last.fm for users (university exercise). I'm new to python and get following error:
Traceback (most recent call last):
File "crawler.py", line 23, in <module>
for f in user_.get_friends(limit='200'):
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylast.py", li...
I need to return two values at a time, so I have:
class IterableObject(object):
def __iter__(self):
for item in self.__dict__:
return self.__dict__[item + 1], self.__dict__[item]
So I can have:
myObj1, myObj2 = IterableObject()
value = myObj1.balance - myObj2.balance
Of course it did not work. What am I doing wrong? ...
I'd like to parallelize my Python program so that it can make use of multiple processors on the machine that it runs on. My parallelization is very simple, in that all the parallel "threads" of the program are independent and write their output to separate files. I don't need the threads to exchange information but it is imperative tha...
My program uses sqlite3 plus python. It works fine with python 2.6.2
I moved it another machine and installed 2.6.4 and running the program gave me this error
File "", line 1, in
File "/opt/python-2.6.4/lib/python2.6/sqlite3/init.py", line 24, in
from dbapi2 import *
File "/opt/python-2.6.4/lib/python2.6/sqlite3/db...
I'm playing with the project appengine-rest-server to create the REST webservices for all the existing models. I got a strange error, the first time I query the browser: http://localhost:8080/rest/metadata/user, it gives me the result:
<xs:schema>
−
<xs:element name="user">
−
<xs:complexType>
−
...
I have an SMTP server that requires secure password authentication (e.g. Outlook requires to check SPA). Is there a way to deal with it with Django SMTPConnection?
Or maybe ideas about any python solution to deal SPA?
Honestly, I couldn't find enough about SPA, to understand what is it exactly:
en.wikipedia:Secure_Password_Authenticat...
hello
how can i read image from clipboard ?
i was only able to raed text using wx.clipboard. but not images
is it possible to read images with wx.clipboard?
or there is another way?
i use python2.5 and windows vita 64 bit
thanks in advance
...
Hi
I managed to upload a file (crud PUT khe khe :) from Linux to Sharepoint.
The absolute path of the file is:
http://myhost/mysite/reports/2010-04-13/file.txt
Now, I'm trying to add some metadata to the file:
from suds.transport.https import WindowsHttpAuthenticated
url='http://myhost/mysite/_vti_bin/lists.asmx?WSDL'
n=WindowsHttpA...
Hello.
I'm trying to use httplib's HTTPSConnection for client validation, using a PKCS #12 certificate. I know the certificate is good, as I can connect to the server using it in MSIE and Firefox.
Here's my connect function (the certificate includes the private key). I've pared it down to just the basics:
def connect(self, cert_file,...
Is anyone familiar with ActiveRecord's "has_many :through" relations for models? I'm not really a Rails guy, but that's basically what I'm trying to do.
As a contrived example consider Projects, Programmers, and Assignments:
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import Column, Fo...
Is it possible to open a file on GAE just to read its contents and get the last modified tag?
I get a IOError: [Errno 13] file not accessible:
I know that i cannot delete or update but i believe reading should be possible
Has anyone faced a similar problem?
os.stat(f,'r').st_mtim
...
Hi guys, in c++ I can wrote:
int someArray[8][8];
for (int i=0; i < 7; i++)
for (int j=0; j < 7; j++)
someArray[i][j] = 0;
And how can I initialize multi-line arrays in python?
I tried:
array = [[],[]]
for i in xrange(8):
for j in xrange(8):
array[i][j] = 0
...
I'm getting strange error "'int' object has no attribute 'startswith'"
I haven't used the word "startswith" in my python program. ?
Does any one how to fix this -- or what it refers to ?
...
hi im doing a loop so i could get dict of data, but since its a dict it's
sorting alphabetical and not as i push it trought the loop ...
is it possible to somehow turn off alphabetical sorting?
here is how do i do that
data = {}
for item in container:
data[item] = {}
...
for key, val in item_container.iteritems():
...
d...
I'm trying to set a page that displays the visitor's IP. All the methods I have tried show an IP different from the IP my computer has. I've tried:
Looking up http://www.whatismyip.com/automation/n09230945.asp
Using socket.getaddrinfo(socket.gethostname(), None)[0][4][0]
How can I find the real IP of the visitor?
...
Hi,
I need to construct an if statement from the data coming from the client as below:
conditions: condition1, condition2, condition3, condition4
logical operators: lo1, lo2, lo3 (Possible values: "and" "or")
Eg.
if condition1 lo1 condition2 lo3 condition4:
# Do something
I can think of eval/exec but not sure how safe they are...
Hi guys,
Sorry to bother again, but I really need help transforming this Python2 code into PHP.
net, cid, lac = 25002, 9164, 4000
import urllib
a = '000E00000000000000000000000000001B0000000000000000000000030000'
b = hex(cid)[2:].zfill(8) + hex(lac)[2:].zfill(8)
c = hex(divmod(net,100)[1])[2:].zfill(8) + hex(divmod(net,100)[0])[2:].zfi...
Hi,
I have a list of objects from a django queryset, e.g.
my_list = MyObject.objects.filter(variable=something)
MyObject has a field called year which is set to a particular year, e.g. 2005, 2007, 2009
I want to take my_list and create a dictionary of years which holds all MyObject values for that year. e.g.
my_dict['2005'] = list ...
I'm writing a pair of simple WSGI applications to get a feel for the standard, and I'm to the point where I'd like to test that my applications are working as expected. Now I'm trying to figure out the best way start and stop a server hosting those applications.
My first thought was to start up the SimpleServer from wsgiref in the setUp...
I am currently writing an API and an application which uses the API. I have gotten suggestions from people stating that I should perform logging using handlers in the application and use a "logger" object for logging from the API.
In light of the advice I received above, is the following implementation correct?
class test:
def __i...