3367: ImportError: No module named fcntl Djblets 0.8, Windows

carlos.corr************@gmai***** (Google Code) (Is this you? Claim this profile.)
May 25, 2014
What version are you running?
2.0, Djblets 0.8

What's the URL of the page containing the problem?
First time I try to access reviewboard

What steps will reproduce the problem?
1. Install ReviewBoard on Windows
2. Access the index page
3. Internal server error

What is the expected output? What do you see instead?
Explained above

What operating system are you using? What browser?
Windows 7, Chrome

Please provide any additional information below.
Hi ReviewBoard developers. I'm Carlos Corrales, Bitnami developer. We are working on the new major version stack and we are having problems with the new Djblets 0.8 in Windows. The error we are getting is

[Thu May 22 09:56:35.183341 2014] [:error] [pid 2892:tid 884] [client 192.168.1.128:49217]   File "E:\\BitNami\\reviewboard-2.0-0\\python\\lib\\site-packages\\djblets-0.8-py2.7.egg\\djblets\\extensions\\manager.py", line 30, in <module>, referer: http://localhost/
[Thu May 22 09:56:35.183341 2014] [:error] [pid 2892:tid 884] [client 192.168.1.128:49217]     import fcntl, referer: http://localhost/
[Thu May 22 09:56:35.183341 2014] [:error] [pid 2892:tid 884] [client 192.168.1.128:49217] ImportError: No module named fcntl, referer: http://localhost

We checked the Djblets Github and the fcntl module was included in Djblets in the latest version
https://github.com/djblets/djblets/commit/c24221f0a4aa29a20fc9b123dd4f2af077cdc3b8

This module is only available in Unix systems. Is there any other module you can use here which could be compatible with Windows too. Can we modify this file to avoid importing fcntl and don't lose its functionality?

Thanks!

Carlos
chipx86
#1 chipx86
Hi Carlos,

We use this to ensure we don't have multiple attempts at writing the media files. It's fairly important for any sites that use extensions.

It turns out that Django provides some abstractions around fcntl and the win32api equivalent. This is lock() and unlock() in django.core.files.locks.

I'd be happy to take a patch that switched us to that. Since you're having to test this on Windows anyway, you'd be in the best position to write this and make sure it works. Would that be okay?
  • +NeedInfo
david
#2 david
Fixed in djblets release-0.8.x (db2f6ce). Thanks!
  • -NeedInfo
    +Fixed
#3 carlos.corr************@gmai***** (Google Code) (Is this you? Claim this profile.)
Thank you too!
#4 carlos.corr************@gmai***** (Google Code) (Is this you? Claim this profile.)
Hi, just a comment. You also need to remove this line

import fcntl

from manager.py, because it fails when it gets there. When are you planning to release the new version with this fix included?

Thanks again!
david
#5 david
Oops. Fixed the import in 84c5784.