# Don't know what is causing the error with expect

**URL:** <https://forum.ansible.com/t/dont-know-what-is-causing-the-error-with-expect/20230>\
**Category:** Ansible Project\
**Created:** [January 15, 2016, 4:36pm UTC](https://forum.ansible.com/t/dont-know-what-is-causing-the-error-with-expect/20230 "2016-01-15T16:36:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Constant](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Mark\_Constant](https://forum.ansible.com/u/Mark_Constant)\
**Post date:** [January 15, 2016, 4:36pm UTC](https://forum.ansible.com/t/dont-know-what-is-causing-the-error-with-expect/20230/1 "2016-01-15T16:36:20Z")

</div>

I don’t know why my expect command below is not working. I used the regex format tester before doing this.

- name: Install Rhapsody  
become: no  
expect:  
command: /tmp/rhapsody-6\_2\_0-linux-x64.sh  
echo: yes  
responses:  
(^)(?i)OK(._): “o”  
(^)(?i)Where should Rhapsody be installed(._): “/rhapsody/rhapsody62/”  
(^)(?i)Where should the data directory be located(._): “/rhapsody/rhapsody62/rhapsody/data”  
(^)(?i)What memory setting should be used(._): “2048”  
(^)(?i)What port settings should be used(._): “3042”  
(^)(?i)Secure Web Management Console Port(._): “8445”  
(^)(?i)Secure Management Webservice Port(.\*): “8450”

I get the following error

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [January 15, 2016, 4:47pm UTC](https://forum.ansible.com/t/dont-know-what-is-causing-the-error-with-expect/20230/2 "2016-01-15T16:47:20Z")

</div>

Does it actually install when using the expect module? It seems as though the failure is because you are getting a return code of 1. If it does install, it might indicate that an rc of 1 is not a failure.

What is the return code after you run it manually/interactively?

---

<div class="post-metadata">

**Author:** ![Mark\_Constant](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Mark\_Constant](https://forum.ansible.com/u/Mark_Constant)\
**Post date:** [January 15, 2016, 6:49pm UTC](https://forum.ansible.com/t/dont-know-what-is-causing-the-error-with-expect/20230/3 "2016-01-15T18:49:43Z")

</div>

No it doesn’t install. I am having a hard time figuring out what return code 1 means or how to get a return code when I do a manual install. This .sh file is a packaged installer from a vendor we use that I am trying to automate, so I don’t have much insight into return codes.

---

<div class="post-metadata">

**Author:** ![Mark\_Constant](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Mark\_Constant](https://forum.ansible.com/u/Mark_Constant)\
**Post date:** [January 15, 2016, 9:23pm UTC](https://forum.ansible.com/t/dont-know-what-is-causing-the-error-with-expect/20230/4 "2016-01-15T21:23:42Z")

</div>

I put in my script for every response question (.\*) and now the script just sits there. What would be the correct python regex for capturing everything including new line? At this point I am just trying to grab anything to see if there issue is the response questions.

---

<div class="post-metadata">

**Author:** ![Mark\_Constant](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Mark\_Constant](https://forum.ansible.com/u/Mark_Constant)\
**Post date:** [January 15, 2016, 9:30pm UTC](https://forum.ansible.com/t/dont-know-what-is-causing-the-error-with-expect/20230/5 "2016-01-15T21:30:51Z")

</div>

I got it going. I basically used the last word in the question and put (.\*$) after it.
