Reputation: 3214
I try to import a module.
# coding: utf-8
import rb
def main():
print "working"
if __name__ == "__main__":
main()
if "import" directive is present, program prints nothing
and I get:
Echo $? shows that program worked correctly.
How can one check whether module was correctly loaded?
P.S. It seems that this module is present in the directory,
because if I delete all another files except interpreted script, I get:
Thanks in advance!
Upvotes: 0
Views: 119
Reputation: 80751
In the rb.py
file, there is a funny line at the end : sys.stdout = _rbdebugfile(sys.stdout.fileno())
, this will redirect the standard stdout (where the printed characters go) to a special file instead of the console.
The lost characters are in the file created by rb.py.
Upvotes: 1
Reputation: 5168
Delete this line from rb.py:
sys.stdout = _rbdebugfile(sys.stdout.fileno())
Upvotes: 1