python

Outbound FTP request from google appengine using python.

Hi All, I need to make an outbound ftp request to retrieve a number of small files. There are 6 files each less than 10K and I only need to retrieve them once every couple of hours. When I try to do this with urllib2.urlopen("ftp://xxx.xxx.xxx") I get an exception AttributeError: 'module' object has no attribute 'FTP_PORT'. I have r...

Locating django app resources

Hello all, tl:dr How would a hosted django app correctly transform resource paths to match any hosted location (/ or /test or /testtest)? Full Description Let me try to explain what I am trying to do. I am trying to write a somewhat re-usable django app which I intend to use from within multiple projects. This app is called systems...

create a tar file in a string using python

I need to generate a tar file but as a string in memory rather than as an actual file. What I have as input is a single filename and a string containing the assosiated contents. I'm looking for a python lib I can use and avoid having to role my own. A little more work found these functions but using a memory steam object seems a littl...

avoid regex [python]

hi, I'd like to know if it's a good idea avoid regex. actually I have avoided it in any case and some peoples has been giving me advice that i shouldn't avoid it, since if you know what means every thing like: [] '|' \A \B \d \D \W \w \S \Z $ * ? ... it would be easy to read, right? but i fell like avoiding regex i woul...

How to make python 3 print() utf8

How to make python 3 (3.1) to print("Some text") to stdout in utf8 ... or how to output raw bytes.. Test.py TestText = "Test - āĀēĒčČ..šŠūŪžŽ" # this is UTF-8 TestText2 = b"Test2 - \xc4\x81\xc4\x80\xc4\x93\xc4\x92\xc4\x8d\xc4\x8c..\xc5\xa1\xc5\xa0\xc5\xab\xc5\xaa\xc5\xbe\xc5\xbd" # just bytes print(sys.getdefaultencoding()) prin...

How can one perform color transforms with ICC profiles on a set of arbitrary pixel values not in an image?

I'd like to convert a set of pixel values from one profiled colorspace to another, without these values residing in an image file, such as (say) a list of RGB/RGBA/CMYK/etc data structures. I have python and PIL at my disposal (but I'm interested in solutions in related environments if that's what it takes). The latest PIL has very nic...

hex <-> RGB <-> HSV Color space conversion with Python

For this project I use Python's colorsys to convert RGB to HSV vice versa to be able to manipulate saturation and lightness, but I noticed that some colors yields bogus results. For example, if I take any primary colors there's no problem: However if I chose a random RGB color and convert it to HSV, I sometime gets bogus results. ...

loop in python !

hello everyone .. can anyone help me with loop i want loop that code login_form_data = urllib.urlencode(login_form_seq) opener = urllib2.build_opener() site = opener.open(B, login_form_data).read() the code allow me to login to site but site have problem and the problem is: you can't login from first time that mean I have to press ...

django-admin.py launches IDE

I just went to create a new django project and I typed django-admin.py startproject my_project into the command prompt and it opened the django-admin.py file in my ide (komodo edit). This happens every time I run this command in any form, even if I just try django-admin.py. Any ideas what's going on and how I fix it? I'm on Win Xp wit...

How does Django's ORM manage to fetch Foreign objects when they are accessed

Been trying to figure this out for a couple of hours now and have gotten nowhere. class other(models.Model): user = models.ForeignKey(User) others = other.objects.all() o = others[0] At this point the ORM has not asked for the o.user object, but if I do ANYTHING that touches that object, it loads it from the database. type(o.us...

Using rpmbuild in Python

Hi, I'm a newbie and I'm trying to write a python script to build rpm packages as part of an automated build system (Hudson). I'm looking at the rpm-python API but I can't seem to see anything that relates to rpmbuild. Am I missing something or is there no way to build an rpm package through the rpm api's? I was hoping I wouldn't hav...

Python's list comprehensions and other better practices

This relates to a project to convert a 2-way ANOVA program in SAS to Python. I pretty much started trying to learn the language Thursday, so I know I have a lot of room for improvement. If I'm missing something blatantly obvious, by all means, let me know. I haven't got Sage up and running yet, nor numpy, so right now, this is all quit...

Getting Monitor resolution in Python on Ubuntu

Is there a equatable bit of code to GetSystemMetrics in win32api, for Ubuntu? I need to get the monitors width and height in pixels. ...

Is it possible to compare the values of a csv and text file in python?

i have a csv file and a text file. is it possible to compare the values in both files? or should i have the values of both in a csv file to make it easier? ...

Python Tool Windows

TL.attributes('-toolwindow', True) I'm making a GUI in Tkinter that uses a tool window, is there anyway to make this window show up in the task bar? ...

XMPP bot status message on GAE

Hi , GAE XMPP documentation states that is not possible to set status message for an app ( https://code.google.com/appengine/docs/python/xmpp/overview.html#Google_Talk_User_Status ). On other hand, I've vark IM client has status message set. Obviously it is not hosted on GAE, but it is possible to set status message for app. I hav...

Scroll to the end (right) in wx.ScrolledPanel

I add dinamically images to wx.ScrolledPanel. I add them sizer which is inside ScrolledPanel. I want to scroll ScrollBar automatically to the end. It is possible? I've read that self.scroll.SetupScrolling(scroll_x=True, scroll_y=False, scrollToTop=False) can resolve this problem, but in my application it doesn't work. Scrolled Panel...

Is there a script to manage/search python snippets which understands python code like nullege.com?

I have a folder full of python snippets and want to search it in a more intelligent way than grep. Is there already a script which parses python snippets to AST and lets you search it, like http://nullege.com? For example, if you have the following code: class InspectionFrame(wx.Frame): def SaveSettings(self, config): w, h ...

Add/remove programs in Windows XP with Python script

I would like to add add/programs like adobe acrobat reader and other application in windows XP using Python script. Kindly looking for some help. Thanks in advance! Everest. ...

Sys.path modification or more complex issue?

Hi, I have problems with importing correctly a module on appengine. My app generally uses django with app-engine-patch, but this part is task queues using only the webapp framework. I need to import django settings for the app to work properly. My script starts with: import os import sys sys.path.append('common/') # Force Django to r...