# File descriptor access in scripting module

**URL:** <https://forum.inductiveautomation.com/t/file-descriptor-access-in-scripting-module/80770>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [October 20, 2023, 3:43pm UTC](https://forum.inductiveautomation.com/t/file-descriptor-access-in-scripting-module/80770 "2023-10-20T15:43:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user69](https://avatars.discourse-cdn.com/v4/letter/u/58f4c7/32.png) [@user69](https://forum.inductiveautomation.com/u/user69)\
**Post date:** [October 20, 2023, 3:43pm UTC](https://forum.inductiveautomation.com/t/file-descriptor-access-in-scripting-module/80770/1 "2023-10-20T15:43:55Z")

</div>

Running Ignition 8.1.31 on a Windows machine.

Is there an idiomatic Jython way, or perhaps some way with Java to interact with the file descriptor value (an integer) returned by `os.open`? The return value appears to be some sort of wrapper class and I'm not sure of how to drill down to the actual integer value. Here's a sample from my REPL showing to reproduce the object I'm struggling with:

```python
>>> import os
>>> fd = os.open("exercise.c", os.O_RDWR)
>>> isinstance(fd, int)
False

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 20, 2023, 5:17pm UTC](https://forum.inductiveautomation.com/t/file-descriptor-access-in-scripting-module/80770/2 "2023-10-20T17:17:48Z")

</div>

Nerd-sniped me.

I put this in a script console:

```auto
import os
f = os.open('/home/philip/.screenrc', os.O_RDWR)
print type(f)
fd = f.getFD()
print type(fd)

```

It yields:

```auto
<type 'org.python.core.io.FileIO'>
<type 'java.io.FileDescriptor'>

```

So, not an integer.

The first of those is here:

> <https://github.com/jython/jython/blob/master/src/org/python/core/io/FileIO.java>

The second is an internal java type with no exposed way to get the numeric fd.

[https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/FileDescriptor.html](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/FileDescriptor.html)

Sorry.

What you actually trying to do?

---

<div class="post-metadata">

**Author:** ![user69](https://avatars.discourse-cdn.com/v4/letter/u/58f4c7/32.png) [@user69](https://forum.inductiveautomation.com/u/user69)\
**Post date:** [October 20, 2023, 5:59pm UTC](https://forum.inductiveautomation.com/t/file-descriptor-access-in-scripting-module/80770/3 "2023-10-20T17:59:19Z")

</div>

A file descriptor priority queue. Just a POC, nothing dedicated to. The current project we have a database table with integer priority column and it works fine. Thank you for poking around 🙂
