I'm looking for a package that will automatically detect the type of and extract an archive (zip, tar.gz, etc). In Perl, this is easy - in Python, I can't find any simple package/class to do it...
Trac is a python-powered bug-tracking and project-management app. According to Trac's wiki, there are several options for installing Trac, a standalone server (tracd), or under a dedicated webserver using one of these options:
FastCGI - Not available on windows.
mod_wsgi - No version of mod_wsgi available for Apache 2.2.22 and Python 2.7.3-amd64 that actually runs on my system!
mod_python - no longer recommended, as mod_python is not actively maintained anymore)
CGI -should not be used, as the performance is far from optimal)
That leaves me with zero ways to run Trac on Windows.
Apache 2.2.22 with ModWSGI loading, crashes the Apache2.2 service on startup without any error logs. Disabling the line in the apache configuration to load mod_wsgi restores sanity.
I just want an installation of Trac on windows with Authentication enabled. I am unable to get authenetication to work using basic tracd like this:
tracd -p 8000 --basic-auth="c:\tmp,c:\tmp\Passwords.md5.txt,mycompany" c:\tmp\RootFolder
And I am unable to get Mod_WSGI installed. I'm going to keep trying to figure out a combination that works, I suspect I should have installed 32 bit python instead of 64 bit python, to start with. Did I do wrong to install Python 64 bit 2.7.3? I tried again with all 32 bit components, and still can't get MOD_WSGI to work with apache 2.2.22. I'm going to try to compile mod_wsgi myself with Visual C++ Express 2010, but it seems to me that it ought to be easier than this to get Trac running on windows, with authentication.
Is there a way to run Trac on Windows, under Apache, with authentication?
The last "Trac on windows" article died in 2008, leaving only this internet archive link for "Trac on windows" setup.
I'm trying to make a siren sound in python with beeps, but had no success..
I'm trying something like
winsound.Beep(700,500)
winsound.Beep(710,500)
winsound.Beep(720,500)
...
It's a better way to do it? And play it?
Without external files...
Thx
I have a python code something like this
file_out.write(str(i).strip()+"\t"+str(dict1[i]).strip()+"\n")
But when i try to recognize this with vim by saying on the file that was written.
:%s/\t/|/g
But it does not recognize the \t
I have a large module written in JS which uses Canvas to draw and animate trees. This module was written for a product which is now being migrated to flex.
Is there a way in flex to embed this JS module as is? Or would I have to rewrite the whole module in AS3 (shudder)? Further, if embedding is possible, would user interactions (mouse clicks) etc. work seamlessly?
An example of the tree structure I am talking about can be found here - http://thejit.org
I have read that SUDS doesn't work on App Engine.
http://osdir.com/ml/fedora-suds-list/2010-03/msg00004.html
Can anyone confirm or refute this? Can you suggest an alternative for calling SOAP services from App Engine's python runtime?
I have no clue of where to start on this. I've never done any NLP and only programmed in a Python 3.1, which I have to use. I'm looking at the site http://www.linkedin.com and I have to gather all of the public profiles and some of them have very fake names, like 'aaaaaa k dudujjek' and I've been told I can use NLP to find the real names, where would I even start?
I'm trying to figure out how to parse a VCard to a Python dictionary using VObject.
vobj=vobject.readOne(string)
print vobj.behavior.knownChildren
This is all I get:
{'CATEGORIES': (0, None, None), 'ADR': (0, None, None), 'UID': (0, None, None), 'PHOTO': (0, None, None), 'LABEL': (0, None, None), 'VERSION': (1, 1, None), 'FN': (1, 1, None), 'ORG': (0, None, None), 'N': (1, 1, None), 'PRODID': (0, 1, None)}
How can I populate the dictionary with my VCard data?
I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organising classes.
I'm on a new computer(mac 10.9.2) and I am attempting to bootstrap my companies project, but setuptools is failing.
I can run python bootstrap.py, which creates the ./bin/buildout, but when I run the buildout, it returns the following error:
Traceback (most recent call last):
File "./bin/buildout", line 17, in <module>
import zc.buildout.buildout
File "/Users/miah/Documents/realmassive/joson/eggs/zc.buildout-1.7.1-py2.7. egg/zc/buildout/buildout.py", line 40, in <module>
import zc.buildout.download
File "/Users/miah/Documents/realmassive/joson/eggs/zc.buildout-1.7.1-py2.7. egg/zc/buildout/download.py", line 20, in <module>
from zc.buildout.easy_install import realpath
File "/Users/miah/Documents/realmassive/joson/eggs/zc.buildout-1.7.1-py2.7. egg/zc/buildout/easy_install.py", line 29, in <module>
import setuptools.archive_util
File "build/bdist.macosx-10.9-intel/egg/setuptools/archive_util.py", line 15, in <module>
ImportError: cannot import name ContextualZipFile
I've attempted installing it via https://pypi.python.org/pypi/setuptools#unix-including-mac-os-x-curl and homebrew.
I have a Python script that will be doing a lot of things that would require root-level privileges, such as moving files in /etc, installing with apt-get, and so on. I currently have:
if os.geteuid() != 0:
exit("You need to have root privileges to run this script.\nPlease try again, this time using 'sudo'. Exiting.")
Is this the best way to do the check? Are there other best practices?
I have a file where the first byte contains encoded information. In Matlab I can read the byte bit by bit with var=fread(file,8, 'ubit1') then retrieve each bit by var(1),var(2), etc.
Is there any equivalent bit reader in python?
I'm trying to maximize a specific window with python...
Here is the deal:
I have a script that opens 2 firefox windows (selenium rc), and I need to maximize the second window, the last one that opens...
How can I do it?
I'm using this command
window = win32gui.GetForegroundWindow()
win32gui.MoveWindow(window, 0, 0, 1440, 900, True)
that works perfectly, but only with the focus window... and the second window of firefox witch opens with the script doesnt get focused...
Hi,
Is it possible using Python COM to select files inside of the windows explorer? For example, I am trying to get all "*.txt" files inside of windows explore highlighted without having to select them with the mouse, or without other keyboard gymnastics.
thanks in advance.
I cannot manage to load the tun module in my archlinux box. I'm trying
to connect with openvpn, but the log says
nm-openvpn[6662]: Note: Cannot open TUN/TAP dev /dev/net/tun: No such device (errno=19)
lsmod | grep tun
returns nothing.
If I run
sudo modprobe tun
it returns failure, but no error message, and lsmod still has no tun. The module seems to exist, as there is a tun.ko.gz in /lib/modules/.......
I really dont know what else to try.
Thanks in advance
Hi, for development i'd love to have a flat file database with the requirements up in the title, but I don't seem to be able to find a database with these requirements. I can't seem to get MetaKit to work. I only need it to work on the development machine, but in the real world my product will have more data and needs more room and will need something better.
Does anyone know of a database engine capable of this or do I need to just use python's pickle and load and save a file?
Joe
Python language has a well known feature named interactive mode where interpreter can read commands directly from tty.
I tipically use this mode to test if a given module is in the classpath or to play around and test some snippets.
Do you know any other programming languages that has Interactive Mode?
I haven’t been able to find a good solution for this problem on the net (probably because switch, position, list and Python are all such overloaded words).
It’s rather simple – I have this list:
['title', 'email', 'password2', 'password1', 'first_name', 'last_name', 'next', 'newsletter']
I’d like to switch position of 'password2' and 'password1' – not knowing their exact position, only that they’re right next to one another and password2 is first.
I’ve accomplished this with some rather long-winded list-subscripting, but I wondered if someone could come up with something a bit more elegant?
In lager.elr (the main module of https://github.com/basho/lager) there is no function with name "debug" but I have an application that call debug function from lager module like:
lager:debug(Str, Args)
I am beginner in Erlang but I know when we call a function from a module lile "mymodule:myfunction" there should be a function with name "myfunction" in file mymodule.erl but in this case when I search in lager.erl for function "debug" I can't find it.
Why does math.factorial act so weird in a thread?
Here is an example, it creates three threads:
thread that just sleeps for a while
thread that increments an int for a while
thread that does math.factorial on a large number.
It calls start on the threads, then join with a timeout
The sleep and spin threads work as expected and return from start right away, and then sit in the join for the timeout.
The factorial thread on the other hand does not return from start until it runs to the end!
import sys
from threading import Thread
from time import sleep, time
from math import factorial
# Helper class that stores a start time to compare to
class timed_thread(Thread):
def __init__(self, time_start):
Thread.__init__(self)
self.time_start = time_start
# Thread that just executes sleep()
class sleep_thread(timed_thread):
def run(self):
sleep(15)
print "st DONE:\t%f" % (time() - time_start)
# Thread that increments a number for a while
class spin_thread(timed_thread):
def run(self):
x = 1
while x < 120000000:
x += 1
print "sp DONE:\t%f" % (time() - time_start)
# Thread that calls math.factorial with a large number
class factorial_thread(timed_thread):
def run(self):
factorial(50000)
print "ft DONE:\t%f" % (time() - time_start)
# the tests
print
print "sleep_thread test"
time_start = time()
st = sleep_thread(time_start)
st.start()
print "st.start:\t%f" % (time() - time_start)
st.join(2)
print "st.join:\t%f" % (time() - time_start)
print "sleep alive:\t%r" % st.isAlive()
print
print "spin_thread test"
time_start = time()
sp = spin_thread(time_start)
sp.start()
print "sp.start:\t%f" % (time() - time_start)
sp.join(2)
print "sp.join:\t%f" % (time() - time_start)
print "sp alive:\t%r" % sp.isAlive()
print
print "factorial_thread test"
time_start = time()
ft = factorial_thread(time_start)
ft.start()
print "ft.start:\t%f" % (time() - time_start)
ft.join(2)
print "ft.join:\t%f" % (time() - time_start)
print "ft alive:\t%r" % ft.isAlive()
And here is the output on Python 2.6.5 on CentOS x64:
sleep_thread test
st.start: 0.000675
st.join: 2.006963
sleep alive: True
spin_thread test
sp.start: 0.000595
sp.join: 2.010066
sp alive: True
factorial_thread test
ft DONE: 4.475453
ft.start: 4.475589
ft.join: 4.475615
ft alive: False
st DONE: 10.994519
sp DONE: 12.054668
I've tried this on python 2.6.5 on CentOS x64, 2.7.2 on Windows x86 and the factorial thread does not return from start on either of them until the thread is done executing.
I've also tried this with PyPy 1.8.0 on Windows x86, and there result is slightly different. The start does return immediately, but then the join doesn't time out!
sleep_thread test
st.start: 0.001000
st.join: 2.001000
sleep alive: True
spin_thread test
sp.start: 0.000000
sp DONE: 0.197000
sp.join: 0.236000
sp alive: False
factorial_thread test
ft.start: 0.032000
ft DONE: 9.011000
ft.join: 9.012000
ft alive: False
st DONE: 12.763000