Where is the location of the fcntl module of python?

馋奶兔 提交于 2019-12-11 10:57:54

问题


I'm on unix but I can't find the location of the fcntl module. I'm using Jython in my web development, and the existing program that I'm modifying needs that module. Can you give me a way to import it or for my code to be able to use this module? Thanks in advance!


回答1:


fcntl is a built-in module. It's not written in Python, but in C. Unfortunately, it hasn't been ported to Java, and according to this bug report, it's unlikely that it ever will be.

To answer your question: it's in the CPython source, here.

The problem is that fcntl is Unix-specific; your program was not portable from the start. Java is pretty strictly platform-independent, and (as the Jython developers imply in that bug report) some low-level things aren't possible. You can search about the particular functions you need — you'll might a better chance of getting that to work than the whole module – but I'd recommend looking for some way around the problem rather than trying to get fcntl to work in Java.

I hope you can find an alternative solution.



来源:https://stackoverflow.com/questions/7723571/where-is-the-location-of-the-fcntl-module-of-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!