Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dealing with pywin32 on Linux

6,415 views
Skip to first unread message

Benedict Verheyen

unread,
Dec 15, 2010, 7:58:49 AM12/15/10
to pytho...@python.org
Hi,


I'm moving my development environment (python, Django, virtualenv) from Windows
to Linux (Debian more specific). However, on one app (uses Django), i have a log on
module that uses AD to authenticate users.
It's based on the active_directory wrapper of Tim Golden.
That needs the win32 module but installation of pywin32 fails on importing:

import _winreg
ImportError: No module named _winreg

Kind of logical in hindsight :)

However, this makes programming and testing under Linux a bit of a pain if you're
dealing with Windows specific stuff.
What is the correct way to proceed (i want to keep my development environment in Linux)?

I could adjust my software modules to use the Linux counterparts of the AD functions
that i have to authenticate.
Or is there another way to deal with this?

Thanks for any insight,

Cheers,
Benedict

Tim Golden

unread,
Dec 15, 2010, 8:37:30 AM12/15/10
to pytho...@python.org

Well I'm not sure how far something like WINE would take you,
but I suggest that trying to develop Windows-specific code in
a Linux Dev environment is creating a rod for your own back.

For the specific case you mention, you should be able to switch,
lock, stock & barrel to python-ldap or other LDAP modules. But
that means a fairly major rewrite, plus that's only one issue.
None of the Windows-specific stuff will work: registry, win32api
calls, whatever you're pulling out of the pywin32 packages.

TJG

Benedict Verheyen

unread,
Dec 15, 2010, 8:51:38 AM12/15/10
to pytho...@python.org
On 15/12/2010 14:37, Tim Golden wrote:

> Well I'm not sure how far something like WINE would take you,
> but I suggest that trying to develop Windows-specific code in
> a Linux Dev environment is creating a rod for your own back.
>
> For the specific case you mention, you should be able to switch,
> lock, stock & barrel to python-ldap or other LDAP modules. But
> that means a fairly major rewrite, plus that's only one issue.
> None of the Windows-specific stuff will work: registry, win32api
> calls, whatever you're pulling out of the pywin32 packages.
>
> TJG

Hi,

thanks for your answer.
For the moment, i only need to connect to AD to authenticate.
But you raise a good point that if I need more functionality, I will encounter problems.

Regards,
Benedict

Steve Holden

unread,
Dec 15, 2010, 9:17:13 AM12/15/10
to pytho...@python.org
Benedict:

Have you considered running a virtual Windows machine to handle the
specific issues that really require a Windows environment? If the
loading isn't at brutal levels VirtualBox is a very adequate solution,
and of course Python user VMWare has a full range of industrial-grade
solutions for virtualization.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon 2011 Atlanta March 9-17 http://us.pycon.org/
See Python Video! http://python.mirocommunity.org/
Holden Web LLC http://www.holdenweb.com/

Benedict Verheyen

unread,
Dec 15, 2010, 9:25:11 AM12/15/10
to pytho...@python.org
On 15/12/2010 15:17, Steve Holden wrote:
<snip>

>>
>> Hi,
>>
>> thanks for your answer.
>> For the moment, i only need to connect to AD to authenticate.
>> But you raise a good point that if I need more functionality, I will encounter problems.
>>
> Benedict:
>
> Have you considered running a virtual Windows machine to handle the
> specific issues that really require a Windows environment? If the
> loading isn't at brutal levels VirtualBox is a very adequate solution,
> and of course Python user VMWare has a full range of industrial-grade
> solutions for virtualization.
>
> regards
> Steve

Hi Steve,

good suggestion. I use VirtualBox for other needs so it's not a lot of hassle to set one up.
Thanks !

Regards,
Benedict


Stefan Sonnenberg-Carstens

unread,
Dec 15, 2010, 10:54:24 AM12/15/10
to pytho...@python.org
Am 15.12.2010 13:58, schrieb Benedict Verheyen:
> Hi,

>
>
> I'm moving my development environment (python, Django, virtualenv) from Windows
> to Linux (Debian more specific). However, on one app (uses Django), i have a log on
> module that uses AD to authenticate users.
> It's based on the active_directory wrapper of Tim Golden.
> That needs the win32 module but installation of pywin32 fails on importing:
>
> import _winreg
> ImportError: No module named _winreg
>
> Kind of logical in hindsight :)
>
> However, this makes programming and testing under Linux a bit of a pain if you're
> dealing with Windows specific stuff.
> What is the correct way to proceed (i want to keep my development environment in Linux)?
>
> I could adjust my software modules to use the Linux counterparts of the AD functions
> that i have to authenticate.
> Or is there another way to deal with this?
>
> Thanks for any insight,
>
> Cheers,
> Benedict
>
Just change to LDAP as authentication method.
Even Active Directory offers LDAP (w/o SSL), and there
are modules to interact with LDAP using python.
And, it is platform indipendent.

See here: http://www.python-ldap.org/

I've done this quite often to auth users in an AD with apache/ldap-auth.

Benedict Verheyen

unread,
Dec 16, 2010, 3:09:55 AM12/16/10
to pytho...@python.org
On 15/12/2010 16:54, Stefan Sonnenberg-Carstens wrote:
<snip>

> Just change to LDAP as authentication method.
> Even Active Directory offers LDAP (w/o SSL), and there
> are modules to interact with LDAP using python.
> And, it is platform indipendent.
>
> See here: http://www.python-ldap.org/
>
> I've done this quite often to auth users in an AD with apache/ldap-auth.

I've already ported some code yesterday with python-ldap.
It works so it's fine for now,

Regards,
Benedict

0 new messages