I have a Python script that I run from a symlinked directory, and I call os.getcwd() in it, expecting to get the symlinked path I ran it from. Instead it gives me the "real" path, and in this case that's not helpful. I need it to actually give me the symlinked version.
Does Python have a command for that?
...
to_friend = User.objects.filter(username=friend_q)[0:1]
If 'friend_q' is NOT inside the User.username...it will give error.
What is the recommended tactic?
Thank you
...
def startConnection(self):
from ftplib import FTP
self.ftp = FTP(self.loginServer)
print 'Loging In'
print self.ftp.login(self.username, self.password)
data = []
self.ftp.dir(data.append)
for line in data:
try:
self.date_str = ' '.join(line.split()[5:8])
newDate = time.strptime(self.date_str,'%b %d %H:%M')
print newDate...
I am looking for a (possibly) pure Python library for persistent hash table (btree or b+tree which would provide following features
Large file support (possibly in terabytes)
Fast enough and low memory footprint (looking for a descent balance between speed and memory)
Low cost of management
Reliability i.e. doesn't corrupt file once th...
I'm trying to integrate the Google Federated Login with a premier apps account, but I'm having some problems.
When I send the request to: https://www.google.com/accounts/o8/ud with all the parameters (see below), I get back both a request_token and list of attributes asked for by Attribute Exchange. This is perfect, as we need the email...
hi,
I'd like to achieve following effect
a=[11, -1, -1, -1]
msg=['one','two','tree','four']
msg[where a<0]
['two','tree','four']
In similar simple fashion (without nasty loops).
PS. For curious people this if statement is working natively in one of functional languages.
//EDIT
I know that below text is different that the requirem...
Trying to add django-registration to my app. I have installed setup tools to use easy_install. I think that works..
I run easy_install django-registation and a cmd prompt window flashes up, does something and closes. I don't think it's an error. But when I look in my app folder, theres nothing relation to django-registration.
Anyone kn...
I've read this SO post around the problem to no avail.
I am trying to decompress a .gz file coming from an URL.
url_file_handle=StringIO( gz_data )
gzip_file_handle=gzip.open(url_file_handle,"r")
decompressed_data = gzip_file_handle.read()
gzip_file_handle.close()
... but I get TypeError: coercing to Unicode: need string or buffer, c...
Looking at comprehensions in Python and Javascript, so far I can't see some of the main features that I consider most powerful in comprehensions in languages like Haskell.
Do they allow things like multiple generators? Or are they just a basic map-filter form?
If they don't allow multiple generators, I find them quite disappointing ...
How to insert repeated message in google protocol buffer _pb2.py file
...
A python script is controlling an external application on Linux, passing in input via a pipe to the external applications stdin, and reading output via a pipe from the external applications stdout.
The problem is that writes to pipes are buffered by block, and not by line, and therefore delays occur before the controlling script receiv...
What simple AtomPub server libraries with file- or DB-based backends can you recommend? Unix-style servers that "do one thing, do it well" are especially welcome.
Maybe even libraries in Python?
...
My CS department is currently considering a new introductory "high level" programming course. It is partly aimed at non-majors or those with other primary majors that will find it useful to build programs, including biocomputation, etc.
I have a PhD in programming languages, but I'm finding it hard to say exactly what languages current...
Is there a way to unlock a file on Windows with a Python script? The file is exclusively locked by another process. I need a solution without killing or interupting the locking process.
I already had a look at portalocker, a portable locking implementation. But this needs a file handle to unlock, which I can not get, as the file is alre...
I'm pretty new to Python still, so I'm trying to figure out how to do this and need some help.
I use return codes to verify that my internal functions return successfully. For example (from internal library functions):
result = some_function(arg1,arg2)
if result != OK: return result
or (from main script level):
result = some_functio...
I have to synchronize two different LDAP servers with different schemas. To make my life easier I'm searching for an object mapper for python like SQLobject/SQLAlchemy, but for LDAP.
I found the following packages via pypi and google that might provide such functionality:
pumpkin 0.1.0-beta1:
Pumpkin is LDAP ORM (without R) for python....
Hello everyone,
I'm writting a small python script notify me when certain condition met. I used smtplib which does the emailing for me, but I also want the script to call my cell phone as well.
I can't find a free library for phone callings. Does anyone know any?
Thanks a lot.
-J
...
I'm writing a program that randomly assembles mathematical expressions using the values stored in this class.
The operators are stored in a dictionary along with the number of arguements they need.
The arguements are stored in a list. (the four x's ensure that the x variable gets chosen often)
depth, ratio, method and riddle are other va...
Hi, starting with a base URL, I'm trying to have selenium loop through a short list of subdomains in csv format (ie: one column of 20 subdomains) and printing the html for each. I'm having trouble figuring it out. Thanks!
from selenium import selenium
import unittest, time, re, csv, logging
subds = csv.reader(open('listofsubdomains.txt...
I have heard that C++ and Python are two of the most used languages.
Which one should I choose?
And in Python - version 2 or 3?
I am looking at basic game development (like a car racing game, for example) and NOT flash/iphone/browser games.
Also I do not want to jump to C#.
C++ vs python is what I am considering...
also, it wou...