python-ldap/win32 or python/ldap/win32
i'm running around in circle trying to to use python/ldap/ on win32(WinXP). I want to write a script that read SQL data(no pbm) and insert member in a AD group(pbm).I used the module Active_Directory(very easy to use).but it read only AD. So i have been try to install python-ldap on a win32/python2.4 install.But each time i try setup.py build i get - running build_ext error: The .NET Framework SDK needs to be installed before building extensions for Python. -- of course i insalled .NET ,and it keeped doing it, google around found some registry key thing that have to be changed.tried that but still nothing.I have been looking around more but the informations i find on that topic seems so clunky and out dated(2004-2003) that i really don't think i should wast my time any further without asking around if i'm going the right direction.Because i have the feeling Python/Ldap/win32 shouldn't be such a problem to use...And if it isn't then...Python is not the language i need to accomplish that task. -- http://mail.python.org/mailman/listinfo/python-list
Py2exe issue
I'm using 2.6 (the issue was the same with 2.5)
script.py:
[code]import re
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-f", "--file", action="store", type="string",
dest="filename")
parser.add_option("-o", "--output", action="store", type="string",
dest="fileout")
(options, args) = parser.parse_args()
from subprocess import Popen, PIPE
if options.fileout:
fileoutput = options.fileout
output = open(fileoutput, "w")
else:
output = open("output.txt", "w")
if options.filename:
rawfile = options.filename
file = open(rawfile)
else:
print "type -h for help"
exit()
from threading import Thread
class Pinger(object):
def __init__(self, hosts):
for host in hosts:
pa = PingAgent(host)
pa.start()
class PingAgent(Thread):
def __init__(self, host):
Thread.__init__(self)
self.host = host
def run(self):
p = Popen('ping -n 1 ' + self.host, stdout=PIPE, stderr=True)
m = re.search('Average = (.*)ms', p.stdout.read())
if m:
output.write (self.host+",pingable\n")
else:
output.write (self.host+",not pingable\n")
if __name__ == '__main__':
pinglist = []
for line in file:
pinglist.append(line.strip("\n"))
Pinger(pinglist)[/code]
py2exe setup.py :
[code]from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1}},
console = [{'script': "script.py"}],
zipfile = None,
)
[/code]
error when the "script.exe" run
[code]Exception in thread Thread-500 (most likely raised during
interpreter shutdown):
Traceback (most recent call last):
File "threading.pyc", line 522, in __bootstrap_inner
File "script.py", line 35, in run
File "subprocess.pyc", line 588, in __init__
[/code]
So the script.py run perfectly well under the py environment but if i
use py2exe to make an exe then i get the error above.
I read the note in the py2exe Fac regarding Popen, but i don't know if
it's relevant in my case.
--
http://mail.python.org/mailman/listinfo/python-list
Re: Py2exe issue
I'm using py2exe-0.6.9.win32-py2.6.exe i used option 3. On a list of 500 i get the same error than previous. On a list of 250 once it just quit leaving the open file at 0k and on the second attempt it failed with the same error and a note about "TypeError: 'NoneType' object is not callable". Basically totally random errors. Obviously there is something that py2exe cannot bundle. because I have been using this script(as *.py) more than 30 times now .And as long as i respect the 500 window$ limitation. I had no issues. -- http://mail.python.org/mailman/listinfo/python-list
Re: Py2exe issue
I just tried to compile with gui2exe. And i ran the exe. it faile the same way but at least generate a log. Exception in thread Thread-1: Traceback (most recent call last): File "threading.pyc", line 522, in __bootstrap_inner File "pingable.py", line 35, in run File "subprocess.pyc", line 588, in __init__ File "subprocess.pyc", line 707, in _get_handles File "subprocess.pyc", line 752, in _make_inheritable WindowsError: [Error 6] The handle is invalid for every entry it generate this error and the line 35 is ...Popen ! -- http://mail.python.org/mailman/listinfo/python-list
Re: Py2exe issue
On Jan 2, 3:08 pm, rcmn wrote: > I just tried to compile with gui2exe. And i ran the exe. it faile the > same way but at least generate a log. > Exception in thread Thread-1: > Traceback (most recent call last): > File "threading.pyc", line 522, in __bootstrap_inner > File "pingable.py", line 35, in run > File "subprocess.pyc", line 588, in __init__ > File "subprocess.pyc", line 707, in _get_handles > File "subprocess.pyc", line 752, in _make_inheritable > WindowsError: [Error 6] The handle is invalid > > for every entry it generate this error and the line 35 is ...Popen ! alright here is the issue : http://www.py2exe.org/index.cgi/Py2ExeSubprocessInteractions -- http://mail.python.org/mailman/listinfo/python-list
parse/slice/...
I'm not sure how to call it sorry for the subject description. Here what i'm trying to accomplish. the script i'm working on, take a submitted list (for line in file) and generate thread for it. unfortunately winxp has a limit of 500 thread . So I have to parse/slice the file by chunk of 500 and loop until the list is done. I though i would of done it in no time but i can't get started for some reason. And i can't find a good way to do it efficiently . Does anyone have something similar to this. thank you -- http://mail.python.org/mailman/listinfo/python-list
