question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

User input broken on raspbian, Ideas?

See original GitHub issue

I have openHTF up and running in a virtual machine running Ubuntu 18.04.2 LTS with Python 3.6.8 so far so good. The examples from the example folder are running without problems.

I like to use the software on a Raspberry Pi 3B running latest raspbian. I tried python 3.5.3 (default on raspbian) and complied installed python 3.6.8 from source, both versions showing the same behavior/error.

Running hello_world_py:

(dhe) pi@openhtfpi:~/playground/openhtf/examples $ python --version
Python 3.6.8
(dhe) pi@openhtfpi:~/playground/openhtf/examples $ python hello_world.py 
enter prompt
Enter a DUT ID in order to start the test.
exit prompt
--> testpoint 2 - 86400
Traceback (most recent call last):
  File "hello_world.py", line 89, in <module>
    test.execute(test_start=user_input.prompt_for_test_start())
  File "/home/pi/python-environments/dhe/lib/python3.6/site-packages/openhtf/core/test_descriptor.py", line 349, in execute
    outcome=final_state.test_record.outcome.name,
AttributeError: 'NoneType' object has no attribute 'name'

The test doesn’t wait at the user input and throws the error directly. During debugging I added the "testpoint2 in user_input.py:

def wait_for_prompt(self, timeout_s=None):
    """Wait for the user to respond to the current prompt.

    Args:
      timeout_s: Seconds to wait before raising a PromptUnansweredError.

    Returns:
      A string response, or the empty string if text_input was False.

    Raises:
      PromptUnansweredError: Timed out waiting for the user to respond.
    """
    with self._cond:
      if self._prompt:
        if timeout_s is None:
          self._cond.wait(3600 * 24 * 365)
        else:
          print ('testpoint 2 - ' + str(timeout_s) )
          self._cond.wait(timeout_s)
          print ('testpoint 3 - ' + str(timeout_s) )
      if self._response is None:
        raise PromptUnansweredError
      print ('self._response' + str( self._response ) )
      return self._response

So my guess is, that the wait is working but somehow the user_input returns immediately on the Raspberry Pi, therefore the name is not set and the test runs into the exception.

Any ideas what is going wrong here. Must be soemething raspbian specific…

Best, Robert

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
arsharma1commented, Jul 9, 2019

This sounds plausibly like a 32-bit overflow issue. The Python runtime adds the the timeout to the current time in a time_t variable, which is likely a signed 32-bit number. The 9223372036.0 timeout plus the current unix time winds up negative, so the internal wait finishes immediately. 584950000.0 is also just enough more than now to also overflow to negative.

I’ll revert the offending commit.

Thanks @justinsg for the additional details.

0reactions
josuedhernandezcommented, Oct 17, 2019

I’ve pushed 1.4.4 to PyPI. Please let me know if you continue to have issues.

Thank you it does work now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Input/output error - Raspberry Pi Forums
Input /output error is not good. It could be that your SD card has become corrupted when the power failed (some of them...
Read more >
50 Cool Raspberry Pi Projects for December 2022 - All3DP
Looking for new applications for your Raspberry Pi 4? Check our list of 50 cool Raspberry Pi projects which are actually useful and...
Read more >
Directly boot into my program that requires user input
I have a project called "Sleepy Notes" where I can type early in the morning and record dreams, poems and crazy ideas.
Read more >
Using SSH on the Raspberry Pi - Pi My Life Up
In this guide we show you how to SSH into Raspberry Pi in just a few short steps. Using SSH allows you to...
Read more >
Common errors using the Raspberry Pi camera module
Are you trying to use the Raspberry Pi camera module, Python, ... here today is to document some of these errors so you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found