I'm trying to open a page at http://localhost:8983/solr/admin/stats.jsp but urllib2.urlopen returns a blank string. It works fine for solr/ and solr/admin, but for all the pages above /solr/admin/ I get nothing but a blank string.
76]: t = urllib2.urlopen('http://localhost:8983/solr/admin/stats.jsp')
77]: s = t.read()
78]: s
78]:
79]...
Is there any Python library that allows me to parse an HTML document similar to what jQuery does?
i.e. I'd like to be able to use CSS selector syntax to grab an arbitrary set of nodes from the document, read their content/attributes, etc.
The only Python HTML parsing lib I've used before was BeautifulSoup, and even though it's fine I k...
Hello!
I want to enable debug (DEBUG = True) For my Django project only if it runs on localhost. How can I get user IP address inside settings.py? I would like something like this to work:
#Debugging only on localhost
if user_ip = '127.0.0.1':
DEBUG = True
else:
DEBUG = False
How do I put user IP address in user_ip variable ...
iam using fabric 0.9.1 version on windows to do some deployment related stuff.
But the moment iam about to run "fab hello" iam facing the following error
D:\pythonscripts>fab hello
Traceback (most recent call last):
File "C:\Python26\Scripts\fab-script.py", line 8, in <module>
load_entry_point('fabric==0.9.1', 'console_scripts',...
I have the following (Python) code to check if there are any rows or columns that contain the same value:
# Test rows ->
# Check each row for a win
for i in range(self.height): # For each row ...
firstValue = None # Initialize first value placeholder
...
i'm trying to use the wave module to read wav files in python.
whats not typical of my applications is that I'm NOT using a file or a filename to read the wav file, but instead i have the wav file in a buffer.
And here's what i'm doing
import StringIO
buffer = StringIO.StringIO()
buffer.output(wav_buffer)
file = wave.open(buffer, ...
Hi,
I'm currently writing a small python app that embeds cherrypy and django using py2app.
It worked well until I tried to include pyobjc in my project, since my app needed a small GUI (which consists of a small icon in the top menu bar + a drop down menu).
I can run my python script without any problem (I'm using python 2.6 with macpo...
i cant import the MySQLdb package in python.. how to install the msqldb package and where to place it in python? then when i compile the code there is an error like no module named MySQLdb.... python version is 2.6.4 then MySQLdb version is 1.2.3c1... pls clarify this....
...
I want send text BBULK to ibm host
i am doing like this
tn = telnetlib.Telnet(HOST)
tn.open(HOST,PORT)
tn.write('BBULK')
but its not working
response i am geting is different
i also tryed by ebcdic characters as as/400 system use that
tn.write('\xc2\xc2\xe4\xd3\xd2')
but still not working..
its working when i have to send numbers to ...
Hi everyone,
The project I am working on at the moment basically takes in an image and then renders a video using blender from the command line. At the moment I am using Twisted to deal with the requests but there is certainly something that I am doing wrong as it is not working how I would like it to. You can see the jist of the progra...
I'm trying to grab a screenshot every 30 seconds and display it on my GUI, heres what I've got so far.
Code:
from Tkinter import *
from PIL import ImageGrab
window = Tk()
box = (100,100,400,400)
MyImage = ImageGrab.grab(box)
MyPhotoImage = PhotoImage(file=MyImage) #I know this is where its going wrong, just not sure how to fix it
Pi...
Hi,
What I am doing right now is reading the values from emailobj.
msg = data['emailobj']
message_body = get_plaintext_body(msg)
text_message = get_decoded_body(message_body)
So it works fine when the email is in text/plain. I can get the values out.
But when the email comes in text/html all my codes goes wrong.
How can I handle t...
hey, I am starting a project and wonder the relationship between the characters in images and the whole web page where the images reside. so first, i want to crawl some images and their web pages.....need to save the crawl result in local disk for further analysis.
I wonder if there is any open source for this issue?
thx^_^
...
I have the following models:
class Application(models.Model):
users = models.ManyToManyField(User, through='Permission')
folder = models.ForeignKey(Folder)
class Folder(models.Model):
company = models.ManyToManyField(Compnay)
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='profile')
company = mode...
Hi,
Trying to execute shell command in background using pythons commands module
>>>import commands
>>>output = commands.getstatusoutput("find / > tmp.txt &")
sh: Syntax error: ";" unexpected
Can anyone explain what is wrong with the syntax ? How should it be executed then ?
Tazim.
...
I want a small python script to set the HUDSON_HOME environment variable.
When using the shell, I can easily do this using >>set HUDSON_HOME=http://localhost:8080
But how can I do the same directly through python?? I don't want to do it by passing the command line to os.system().. can os.environ() be of any help??
I had in my script:
...
def _table_(request,id,has_permissions):
dict = {}
dict.update(get_newdata(request,rid))
return render_to_response('home/_display.html',context_instance=RequestContext(request,{'dict': dict, 'rid' : rid, 'has_permissions' : str(has_permissions)}))
In templates the code is as,
{% if has_permissions == "1" %}
<input type="b...
Dear all,
I would like to store and load numpy arrays from binary files. For that purposes, I created two small functions. Each binary file should contain the dimensionality of the given matrix.
def saveArrayToFile(data, fileName):
with open(fileName, 'w') as file:
a = array.array('f')
nSamples, ndim = data.shape
...
On Tiger, I used a custom python installation to evaluate newer versions and I did not have any problems with that*. Now Snow Leopard is a little more up-to-date and by default ships with
$ ls /System/Library/Frameworks/Python.framework/Versions/
2.3 2.5 2.6 @Current
What could be considered best practice? Using the pytho...
Hi,
When creating templates I typically have 3 separate parts (header, body, footer) which I combine to pass a single string to the web-server (CherryPy in this case).
My first approach is as follows...
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader(''))
tmpl = env.get_template('Body.html'...