urlretrieve in liunx ? python
hello, does urllib.urlretrieve('www.xx.com/x.txt') work in linux ? ...
hello, does urllib.urlretrieve('www.xx.com/x.txt') work in linux ? ...
I installed both Python 2.7 and Python 2.6.5. I don't know what went wrong, but nothing related to Python seems to work any more. e.g. "setup.py install" for certain packages don't recognize the "install" parameter and other odd phenomena... I would like to completely remove Python from my system. I tried running the 2.7 and 2.6 msi fil...
I'm doing print statements in python. I'm executing my script like so: python script.py > out.log nohup & The print statements are not all showing up in out.log but the program is finishing ok. That line of code is in an .sh file I execute by doing ./script.sh Update: The log does get all the data but not until a certain # of lines ...
I'd like to run a process and not wait for it to return. I've tried spawn with P_NOWAIT and subprocess like this: app = "C:\Windows\Notepad.exe" file = "C:\Path\To\File.txt" pid = subprocess.Popen([app, file], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE).pid However, the console window remains until I close Notepad. I...
Hey guys, I have a png file generated by Gnuplot that I need to put into an excel document using XLWT. XLWT can't import PNG's into the document, only BMP's, so I needed to convert the PNG first. I used PIL for this. Here's the relevant code: im = Image.open('%s' % os.path.join(os.getcwd(), s + '.png')) im.save('%s.bmp' % s) However...
Hey everyone! I'm a little stumped here, I can't find what I'm looking for in the Django docs... What I want, is to be able to override the Save method of an Model. I want it to check for a certain set of conditions - if these conditions are met, it will create the object just fine, but if the conditions are not met, I want to raise an...
I have a VBox which looks like this: ImportantWidget HSeparator Label I want this window to be only as wide as ImportantWidget needs to be, and no wider. However, the Label can sometimes grow to be very long. I want the following logic: if Label can fit all its text without expanding the VBox horizontally (after it has grown eno...
Using OpenID auth, which is the proper User instance method to get a unique identifier useful for creating and identifying a user on Datastore as key_name? Available methods : nickname() For OpenID users, the nickname is the OpenID identifier. federated_identity() Returns the user's OpenID identifier. federated_provide...
Can someone please show me how to convert this curl call into call using python urllib2 curl -X POST -H "Content-Type:application/json" -d "{\"data\":{}}" -H "Authorization: GoogleLogin auth=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789...XYZ" https://www.googleapis.com/prediction/v1/training?data=${mybucket}%...
Does anyone know of a good guide for the python interpreter? I want to know details as to how it handles files it is interpreting. I have some python files on a shared drive that I want multiple processes to use but I do not know if the separate instances of the interpreter will affect one and other. Any insight would be greatly apprecia...
I've got a good grasp on C, my first programming language. I know a reasonable number of tricks and techniques and have written quite a few programs, mostly for scientific stuff. Now I'd like to branch out and understand OOP, and Python seems like a good direction to go. I've seen several questions on how to learn Python, but most of th...
I have a string string='texttexttextblahblah",".' and what I want to do is cut of some of the rightmost characters by indexing and assign it to string so that string will be equal to texttexttextblahblah" I've looked around and found how to print by indexing, but not how to reassign that actual variable to be trimmed. ...
Could someone help me or share some code to auto fill a login with mechanize (http://wwwsearch.sourceforge.net/mechanize/)? I want to make a python script to log me into my favorite sites when I run it. Thanks! ...
I am on Mac, Snow Lepard. In preparation to install PIL I need to install libjpeg. So, from my home directory I did: tar zxvf jpegsrc.v6b.tar.gz cd jpeg-6b cp /usr/share/libtool/config/config.sub . cp /usr/share/libtool/config/config.guess . ./configure --enable-shared --enable-static make sudo make install But actually I read later...
I'm trying to do the following: import sys; sys.path.append('/var/www/python/includes') import functionname x = 'testarg' fn = "functionname" func = getattr(fn, fn) func (x) but am getting an error: "TypeError: getattr(): attribute name must be string" I have tried this before calling getattr but it still doesn't work: str(fn) ...
I'm new to SQLAlchemy, but I'm trying to use it to create and fill a database for a personal project. I've set pool_timeout to 43200 (twelve hours), but I'm still getting socket timeouts. engine = sqlalchemy.create_engine( 'postgresql+pg8000://gdwatson:pass@localhost/dbname', pool_timeout=43200) db.tables.meta.d...
I tried launching my Google App Engine app on localhost, and got a Django error I am stuck on. "TemplateSyntaxError: Template 'base/_base.html' cannot be extended, because it doesn't exist" I put the templates in a /templates, and then _base.html & index.html in /templates/base . Thanks! Emile @ proudn00b.com The Error: Traceback (m...
So I have a C program to interface with an i2c device. I need to interface to that device from python. I'm just wondering if it's worth porting the program into a python module or if the amount of effort involved in porting won't outweigh just executing the program using subprocess. I know I'm sure it's different for every application, b...
I cannot seem to find a way to modify a form that has been created via: from gluon.tools import Crud crud = Crud(globals(), db) form = crud.create(db.table_name) Since I am using foreign keys in my table, the auto-generated form only allows an integer (which represents the foreign primary key), but what I want to be able to do is ent...
I have a string buffer: b = create_string_buffer(numb) where numb is a number of bytes. In my wrapper I need to splice up this buffer. When calling a function that expects a POINTER(c_char) I can do: myfunction(self, byref(b, offset)) but in a Structure: class mystruct(Structure): _fields_ = [("buf", POINTER(c_char))] I am unabl...