php-python
php-python copied to clipboard
Readline shell
I've done the readline shel now :
- first in php calling python_exec
- then in python completely calling readline in php via php.call
- history up down forward backward works fine
- saving history works fine
- Auto complete... doesn't want to work fine =(
There seems to be something odd with Python object instantiating python objects in php.
The print_r export:
Python rlcompleter.Completer Object
(
[namespace] => Python <type 'dict'> Object
(
)
[use_main_ns] => 0
[__module__] => rlcompleter
[complete] => Python <type 'function'> Object
(
)
[attr_matches] => Python <type 'function'> Object
(
)
[global_matches] => Python <type 'function'> Object
(
)
[_callable_postfix] => Python <type 'function'> Object
(
)
[__doc__] =>
[__init__] => Python <type 'function'> Object
(
)
)
Looks like it might be ok right?
From ReflectionObjert::export this comes to light:
Object of class [ <internal:python> class Python ] {
- Constants [0] {
}
- Static properties [0] {
}
- Static methods [0] {
}
- Properties [0] {
}
- Dynamic properties [9] {
Property [ <dynamic> public $namespace ]
Property [ <dynamic> public $use_main_ns ]
Property [ <dynamic> public $__module__ ]
Property [ <dynamic> public $complete ]
Property [ <dynamic> public $attr_matches ]
Property [ <dynamic> public $global_matches ]
Property [ <dynamic> public $_callable_postfix ]
Property [ <dynamic> public $__doc__ ]
Property [ <dynamic> public $__init__ ]
}
- Methods [0] {
}
}
Not exactly what we are aiming for since those are supposed to be methods. And it's no lies they fail the is_callable test too. Maybe it's something that has changed in zend or the extensions since but this will obviously no work as either a property or a callback.
@jparise any ideas or something ring a bell? I'm looking through the code and comparing to other extensions but nothing has jumped out at me yet. Can't find lots of documentation either. What do you think?