0

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:

enter image description here

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!

2
  • Seems like rb.py calls os._exit(0). Commented Aug 26, 2013 at 13:35
  • it's a good idea to check it! it's rb.py file - paste.debian.net/30379 . I didn't find such instruction there( Commented Aug 26, 2013 at 13:38

2 Answers 2

1

Delete this line from rb.py:

sys.stdout = _rbdebugfile(sys.stdout.fileno())
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.