flags is not a parameter in open

https://docs.python.org/3.0/library/os.html. says this: The following constants are options for the /flags/ parameter to the open() <https://docs.python.org/3.0/library/functions.html#open> function. ... os.O_NDELAY When I follow the link to the open function it does NOT have a flags parameter: open(/file/[, /mode='r'/[, /buffering=None/[, /encoding=None/[, /errors=None/[, /newline=None/[, /closefd=True/]]]]]])¶ <https://docs.python.org/3.0/library/functions.html#open> I am trying to solve this: My C-code uses: fd = open("/dev/ttyAMA0",O_RDW|O_NDELAY) the equivalent code in python3 (Raspberry-Pi) gives an error: fd = open("/dev/ttyAMA0",os.O_RDW|os.O_NDELAY) open() second argument must be str, not int -- Gert

Hi Gert, On Mon, Aug 18, 2014 at 7:47 AM, Gert <gert@fenlogic.com> wrote:
Version 3.0 is almost certainly not the version of Python you are using (and if it is, upgrade now! 3.0 has been unsupported for about 5 years now, 3.4 is current); you would be better served to use the version of the documentation that matches your version of Python. You can either replace the '3.0' in that address with the correct version number (probably 3.3 or 3.4), or just remove the '.0' to get the latest Python3 documentation (currently 3.4).
says this: The following constants are options for the flags parameter to the open() function. ... os.O_NDELAY
When I follow the link to the open function it does NOT have a flags parameter: open(file[, mode='r'[, buffering=None[, encoding=None[, errors=None[, newline=None[, closefd=True]]]]]])¶
This was a bug in the documentation, the link should have gone to 'os.open' rather than the 'open' built-in function. It has been fixed in more recent versions. Hope this helps, -- Zach

Thank you, I found the documentation. My program, is now use os.open and os.write and works. -- Gert van Loo On 20/08/2014 07:13, Zachary Ware wrote:
Hi Gert,
On Mon, Aug 18, 2014 at 7:47 AM, Gert <gert@fenlogic.com> wrote:
https://docs.python.org/3.0/library/os.html. Version 3.0 is almost certainly not the version of Python you are using (and if it is, upgrade now! 3.0 has been unsupported for about 5 years now, 3.4 is current); you would be better served to use the version of the documentation that matches your version of Python. You can either replace the '3.0' in that address with the correct version number (probably 3.3 or 3.4), or just remove the '.0' to get the latest Python3 documentation (currently 3.4).
says this: The following constants are options for the flags parameter to the open() function. ... os.O_NDELAY
When I follow the link to the open function it does NOT have a flags parameter: open(file[, mode='r'[, buffering=None[, encoding=None[, errors=None[, newline=None[, closefd=True]]]]]])¶ This was a bug in the documentation, the link should have gone to 'os.open' rather than the 'open' built-in function. It has been fixed in more recent versions.
Hope this helps,
participants (2)
-
Gert
-
Zachary Ware