Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
77 user(s) are online (47 user(s) are browsing Forums)

Members: 0
Guests: 77

more...

Headlines

 
  Register To Post  

Python fnctl (Unix) module lacking ?
Just can't stay away
Just can't stay away


See User information
Could it be that the fnctl Unix module should be added to the standard install AOS4 install?

fnctl.so is descried as an interface to it.

If yes can it be downloaded somewhere without having to download a complete UNix install ??

Go to top
Re: Python fnctl (Unix) module lacking ?
Amigans Defender
Amigans Defender


See User information
@JosDuchIt

could you provide a small example so we can file a bugzilla entry?

i'm really tired...
Go to top
Re: Python fnctl (Unix) module lacking ?
Just can't stay away
Just can't stay away


See User information
@afxgroup
The script was suggested to me and it would take me too long to shorten it with my present python knowledge


Outputhelp.py
-------------------
# pipe the output of Python help() to a string

import subprocess

code_str = """\
help("print")
"""

# save the code
filename = "help_code.py"
fout = open(filename, "w")
fout.write(code_str)
fout.close()

# execute the .py code and pipe the result to a string
# give the full path of python.exe (here Windows path)
test = "Python" + filename
process = subprocess.Popen(test, shell=True, stdout=subprocess.PIPE)
# important, wait for external program to finish
process.wait()
print process.returncode # 0 = success, optional check
# read the result to a string
help_str = process.stdout.read()

# the result of the code is now in help_str
print('-'*70)
print(help_str) # test

# optionally write to a file
# change the filename as needed
fname = "help_print.txt"
fout = open(fname, "w")
fout.write(help_str)
fout.close()
print('-'*70)
print("file %s written" % fname)

gives me the following errors

1.Amiga OS 4:System/Python/Scripts> python Outputhelp.py
Traceback (most recent call last):
File "Outputhelp.py", line 18, in <module>
process = subprocess.Popen(test, shell=True, stdout=subprocess.PIPE)
File "PYTHON:Lib/subprocess.py", line 594, in __init__
errread, errwrite)
File "PYTHON:Lib/subprocess.py", line 1010, in _execute_child
self._set_cloexec_flag(errpipe_write)
File "PYTHON:Lib/subprocess.py", line 973, in _set_cloexec_flag
old = fcntl.fcntl(fd, fcntl.F_GETFD)
IOError: [Errno 78] Function not implemented

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project