I updated my python interpreter, but I think the old one is still called. When I check for the version I get:
$ python -V
Python 3.0.1
But I believe the old interpreter is still being called. When I run the command:
python myProg.py
The script runs properly. But when I invoke it with the command
./myProg.py
I get the error messa...
I'm a reasonably skilled programmer, and I'm interested in branching out into some new languages -- python, specifically -- but frankly I do NOT want to go through a tutorial that assumes I know nothing about programming. I want a tutorial -- again, preferably for python -- that assumes I'm just unfamiliar with the language itself and d...
Hello,
I try to automatically download a file by clicking on a link on the webpage.
After clicking on the link, I get the 'File Download' Window dialog with 'Open', 'Save' and 'Cancel' buttons. I would like to click the Save button.
I use watsup library in the following way:
from watsup.winGuiAuto import *
optDialog = findTopWindow(w...
I need to browse the DOM tree of a parsed HTML document.
I'm using uTidyLib before parsing the string with lxml
a = tidy.parseString(html_code, options)
dom = etree.fromstring(str(a))
sometimes I get an error, it seems that tidylib is not able to repair malformed html.
how can I parse every HTML file without getting an error (parsing...
Hi guys,
Pretty new to Python so be nice please!
I have a string of text-how do I remove all the text after some certain characters? The text after will change so I want to remove after some text which doesn't change.
Hope that makes sense!
Thanks
...
How come this works:
import datetime
now = datetime.datetime.now()
month = '%d' % now.month
print month
But this doesn't?
import datetime
now = datetime.datetime.now()
month = '%m' % now.month
print month
Thanks!
...
Hey guys,
Currently having some problems-
now = datetime.datetime.now()
month = now.strftime("%B")
site = wikipedia.getSite('en', 'wikiquote')
page = wikipedia.Page(site, u"Wikiquote:Quote_of_the_day:abc")
I need to get abc to change into the name of the month before it then tries to get the page, yet everything I try it gives an er...
When using Python strftime, is there a way to remove the first 0 of the date if it's before the 10th ie. so 01 is 1? Can't find a %thingy for that?
Thanks!
...
Does anyone know of anywhere where you can put a script online & then run it from there so you can run it wherever you are in the world?
Thanks!
...
Ok newbee question: Is there an equivalent to 'intellisense' for Python?
Perhaps i shouldn't admit it but I find having intellisense really speeds up the 'discovery phase' of learning a new language. For instance switching from VB.net to C# was a breeze due to snippets and intellisense helping me along.
...
I'm trying to learn a little about python scripting in GVim, but I'm having trouble with starting. Elementary things, really.
Are there any resources / tutorials concerting python scripting in Vim out there ? Simple examples which show the basic principles, would be welcomed also.
...
This could be a stupid question, but I'm testing out some of my assumptions about Python and I'm confused as to why the following code snippet would not exit when called in the thread, but would exit when called in the main thread.
import sys, time
from threading import Thread
def testexit():
time.sleep(5)
sys.exit()
print "post thr...
I am using /bin/tcsh as my default shell.
However, the tcsh style command os.system('setenv VAR val') doesn't work for me. But os.system('export VAR=val') works.
So my question is how can I know the os.system() run command under which shell?
...
I'm struggling with implementing the Bridge design pattern (or an alternative such as Adapter) in Python
I want to be able to write code like this to dump database schemas based on a supplied URL:
urls = ['sqlite://c:\\temp\\test.db', 'oracle://user:password@tns_name'];
for url in urls:
db = Database(url);
schema = db.schema()
...
I'm trying to write a script which can automatically download gameplay videos. The webpages look like dota.sgamer.com/Video/Detail/402 and www.wfbrood.com/movie/spl2009/movie_38214.html, they have flv player embedded in the flash plugin.
Is there any library to help me find out the exact flv urls? or any other ideas to get it?
Many than...
Hi,
I have a form with 2 buttons. depending on the button click user is
taken to different url.
view function is :
friend_id = request.POST.get('selected_friend_id_list')
history = request.POST.get('statushistory')
if history:
print "dfgdfgdf"
return HttpResponseRedirect('../status/')
else:
return direct_to_template(reque...
FILE: b.py
class B:
def __init__(self):
print "B"
import a
a = A()
FILE: a.py
class A(B): ###=> B is not defined
def __init__(self):
print "A"
When I try to execute b.py, it's said that B is not defined. Am I misunderstanding "import"?
Thanks a lot if you can pointer out the problem.
...
Following on my previous question, if I have some hosting how can I put a python script on their that I can then run from there? Do I need to do something special to run it/install something?
EDIT-Clarification-I would like to be able to upload the script which does stuff on the internet-no data is stored on my computer. I then need to...
Hi,
I've came up with problem regarding unregistering protocols from reactor in twisted while application is running.
I use hardware modems connected to PC by USB and that's why this scenario is so important for my solution.
Has anyone an idea how to do it?
Greets,
Chris
...
Hi, I'm writing a little script for Ubuntu.
My intention is to call rhythmbox lyrics plug-in with a global short-cut (configuring gnome) .
I can call it from rhythmbox python console, but I don't know how to import rhythmbox built-in modules (eg. rhythmdb).
Any ideas?
...