Hi!
I just need some advice. I already know how to play with bash, ruby, python and perl and I'd like to know: with which of them would it be faster to make a little script that would connect to a website with SSL and login.
I just need to do this script and make a cron job with it. So it must be executable from the console.
Thanks.
...
I have an application where I'm embedding python. It was developed on windows where it works fine, but now I'm porting it to linux with less success where it crashes in Py_Initialize(). From gdb, it seems to happen when loading the os module.
gdb reports this callstack on seg fault:
#0 0x002384fc in import_submodule (mod=None, subname...
I have class A that is supposed to inherit class B whose name is not yet known at the time of A being written. Is it possible to declare A not inheriting anything, and add B as the base class during A's instantiation? Example:
First file
class B:
def __init__(self):
self.__name = "Class B"
def name(self):
return self.__nam...
I'm wondering what techniques people use for simplifying the 'size' of code used for unit testing. For example I was trying to marshal an object of the class and testing the marshal'ed object (but this presumes marshal is working correctly).
Consider the class
import unittest
class Nums(object):
def __init__(self, n1_, n2_, n3_):
...
Hi,
Does anybody know of a method, or perhaps a plug-in, that will
automatically fold long docstrings in python? I have docstrings in my
code that span several pages, so it is troublesome to keep paging
through them. The other tricky part is that there is embedded python
testing code in the docstrings, so that might make parsing the...
I am writing a google app engine app and I have this key value error upon requests coming in
from the backtrace I just access and cause the key error
self.request.headers
entire code snippet is here, I just forward the headers unmodified
response = fetch( "%s%s?%s" % (
self.getApiServer()...
I have a Python Unicode string. I want to make sure it only contains letters from the Roman alphabet (A through Z), as well as letters commonly found in European alphabets, such as ß, ü, ø, é, à, and î. It should not contain characters from other alphabets (Chinese, Japanese, Korean, Arabic, Cyrillic, Hebrew, etc.). What's the best way t...
Let's say I have 3 files:
a.py
from d import d
class a:
def type(self):
return "a"
def test(self):
try:
x = b()
except:
print "EXCEPT IN A"
from b import b
x = b()
return x.type()
b.py
import sys
class b:
def __init__(self):
if "a" ...
I would like to create a mdb database file in windows with Python and can't seem to figure it out with the Python Docs. Everything I read about is related to making a connection and what to do with the cursor.
Any thoughts? Thanks...
...
I'd like to use TextMate for debugging python scripts. I'm looking for suggestions on the best way to accomplish this. I found these "solutions" -- is there a better approach?
http://www.libertypages.com/clarktech/?p=192
http://stackoverflow.com/questions/1775954/using-python-3-1-with-textmate
I'd really like to find something as u...
I have file about 4MB (which i called as big one)...this file has about 160000 lines..in a specific format...and i need to cut them at regular interval(not at equal intervals) i.e at the end of a certain format and write the part into another file..
Basically,what i wanted is to copy the information for the big file into the many smalle...
I need to fit some points from different datasets with straight lines. From every dataset I want to fit a line. So I got the parameters ai and bi that describe the i-line: ai + bi*x. The problem is that I want to impose that every ai are equal because I want the same intercepta. I found a tutorial here: http://www.scipy.org/Cookbook/Fitt...
In Python I'm using a dictionary display:
myAnonDict = {'foo': 23, 'bar': 'helloworld'}
Is there an equivalent in Java?
[edited 'anonymous dictionary' to read 'dictionary display']
...
How do I remove a character from an element in a list?
Example:
mylist = ['12:01', '12:02']
I want to remove the colon from the time stamps in a file, so I can more easily convert them to a 24hour time. Right now I am trying to loop over the elements in the list and search for the one's containing a colon and doing a substitute.
fo...
does write mode in file create a file if not existing??
a=open ('C:/c.txt' , 'w')
create a file x.txt if not existed..
how to create a file for writing if it does not as it is giving me error message saying there is no such file. when used the above line of code
...
Hi all, somewhat open ended question here as I am mostly looking for opinions. I am grabbing some data from craigslist for apt ads in my area since I am looking to move. My goal is to be able to compare items to see when something is a duplicate so that I don't spend all day looking at the same 3 ads. The problem is that they change t...
I am wondering what the pros and cons of importing a python module and/or function inside of the a function. Does it re-import every time the function is run? Does it import once at the beginning whether or not the function is run?
Anyways I would appreciate Pros and Cons of importing inside of a function, more specifically on efficien...
I ran into the following problem: I need to supply the installation package to the client. Part of the code is python, so I have to make sure that it is installed. I am using NSIS for the installation ans would like to install python into a predefined by me folder (let it be c:\Program Files\Project\Python26). For that I downloaded the p...
I've been trying to get crontab to work for a while but it doesnt seem to want to work. The python script I need to initialise every midnight works perfectly from the command terminal. The location of my python script is:
/home/rv/ncbi-blast-2.2.23+/database_backup/backup.py
My contab looks like this:
SHELL=/bin/bash
PATH=/sbin:/...
I have created a xml file using xml.etree.ElementTree in python. I then use
tree.write(filename, "UTF-8")
to write out the document to a file.
But when I open filename using a text editor (vi on linux), there are no newlines between the tags. Everything is one big line
How can I write out the document in a "pretty printed" format s...