I am setting out to do a side project that has the goal of translating code from one programming language to another. The languages I am starting with are PHP and Python (Python to PHP should be easier to start with), but ideally I would be able to add other languages with (relative) ease. The plan is:
This is geared towards web develo...
Alright so, before I really get into this post, I am going to have to warn you that this might not be an easy fix. Whoever reads and is able to reply to this post must know a lot of c/c++, and at least some python to be able to answer the question I have above.
Basically, I have a connection method from Mumble (a VOIP client), that con...
I have this code that executes when a player attempts to eat something:
def eat(target='object'):
global current_room
global locations
global inventory
if target in inventory:
items[target]['on_eat'] #This is showing no results.
else:
print 'You have no ' + target + ' to eat.'
and this code for item...
i want to start gpgpu programming in python. should i start with pyopencl or clyther? whats the difference?
...
What's the ideal Python version for a beginner to start learning Python? I need to recommend some newbies a programming language to learn and I chose Python. I'm still not sure which version.
...
After fighting with different things here and there, I was finally able to get BottlePY running on Apache and run a MongoDB powered site. I am used to running Django apps, so I will be relating to that a bit in my question.
The Problem
Every time a page is loaded via BottlePY, the connection to the MongoDB database located on MongoHQ.c...
Hi everyone,
I'm new to selenium. I want to ask about if there's a easy way to open a search result page of some urls, not just the homepages.
for examples,
I search stack overflow in google. The url is here, but the return page is google homepage.Is it possible to get the result page directly? I want to scratch some result pages. If I...
I have a module including definitions for two different classes in Python. How do I use objects of one class as an argument of the other? Say, I have class definitions for Driver and Car, and tuen want to have a Driver object as an argument for a Car object.
...
I have 2 large logfiles. I want to see if a device is in a but not b and vice versa (exclude lines where the device is common) the files look like this example.
04/09/2010,13:11:52,Authen OK,user1,Default Group,00-24-2B-A1-08-88,29,10.1.1.1,(Default),,,,,,13,EAP-TLS,,device1,
04/19/2010,15:35:24,Authen OK,user2,Default Group,00-24-2B-...
I want to be able to use Popen.communicate and have the stdout logged to a file (in addition to being returned from communicate().
This does what I want - but is it really a good idea?
cat_task = subprocess.Popen(["cat"], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
tee_task = subprocess.Popen(["tee", "-a", "/tmp/logcmd"], stdin=cat...
Hi everyone,
I use seleniumRC to open a url, then how to save this web page? How to realize it like urllib.urlretrieve do it? But urllib can't operate javascript in the page. One more question: Will it save the whole page with what I see as seleniumRC open it?
...
What i want to is, I have foo.py it imports classes from bar1, bar2, and they both need bar3, e.g.
foo.py
from src import *
...
src/ __ init__.py
from bar1 import specialSandwichMaker
from bar2 import specialMuffinMaker
src/bar1.py
import bar3
class specialSandwichMaker(bar3.sandwichMaker)
...
src/bar2.py
import bar3
class spe...
I have a rather simple Python script that contains a function call like
f(var, other_var)
i.e. a function that gets several parameters. All those parameters can be accessed within f and have values.
When I instead call
cProfile.run('f(var, other_var)')
it fails with the error message:
NameError: "name 'var' is not defined"
Python ...
I downloaded an open source project http://gmapcatcher.googlecode.com/files/GMapCatcher-0.7.2.0.tar.gz and I am trying to modify a few things in the code but don't know how to test the code!
I tried to make an installer for the project but nothing worked till now maybe I didn't follow the right steps or I am missing somthing.
my questi...
Hello all. I am a newbe to Python.
I have tried to create a class, named ic0File.
Here is what I get when I use it (Python 3.1)
>>> import sys
>>> sys.path.append('/remote/us01home15/ldagan/python/')
>>> import ic0File
>>> a=ic0File.ic0File('as_client/nohpp.ic0')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
...
I have lines of the following format in a file.
Summary;meeting;Description;None;DateStart;20100629T110000;DateEnd;20100629T120000;Time;20100805T084547Z
I need to create a function that has two inputs: time and date in the following formats Time: HH:MM and date as mmddyyyy. (These are strings). Now the function needs to read this line...
I have defined a tuple thus:
(slot, gameid, bitrate)
and created a list of them called myListOfTuples. In this list might be tuples containing the same gameid.
E.g. the list can look like:
[
(1, "Solitaire", 1000 ),
(2, "Diner Dash", 22322 ),
(3, "Solitaire", 0 ),
(4, "Super Mario Kart", 854564 ),
... and so on.
]
...
I have an abstract base class for defining common attributes shared by different user profiles.
class Profile(models.Model):
...
def has_permissions(self, project):
...
class Meta:
abstract = True
class Standard(Profile):
...
class Premium(Profile):
...
Now I would like to check the permission of a certa...
I'm trying to write a GUI program grabbing specific contents from a webpage. The idea is when I hit the start button, the program should start extracting information from that page. And I want to add some code to check if connected to the Internet. If not, continue trying until connected.
So I just added the following code in the event...
I have a web service that is required to handle significant concurrent utilization and volume and I need to test it. Since the service is fairly specialized, it does not lend itself well to a typical testing framework. The test would need to simulate multiple clients concurrently posting to a URL, parsing the resulting Http response, che...