# Stream does not exist

**URL:** <https://swi-prolog.discourse.group/t/stream-does-not-exist/4507>\
**Category:** Help!\
**Created:** [October 1, 2021, 10:50am UTC](https://swi-prolog.discourse.group/t/stream-does-not-exist/4507 "2021-10-01T10:50:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jrdn40](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jrdn40](https://swi-prolog.discourse.group/u/Jrdn40)\
**Post date:** [October 1, 2021, 10:50am UTC](https://swi-prolog.discourse.group/t/stream-does-not-exist/4507/1 "2021-10-01T10:50:23Z")

</div>

Hey, first of all:  
Sorry, i think i will have many question in the future 😃  
This question might be so easy that i couldnt find an explanation for this:  
I need a simple script, that asks users for their preferences to show the perfect car for them.

I started with this basic script, but im getting an error: “stream ‘tiguan’ does not exist”.

my code:

```prolog
car(vw,'SUV',tiguan,2010,benzin).
read_car:-
   write("Which car brand do you prefer?"),nl,
   read(Carbrand),nl,
   write("Which type do you prefer?(SUV,Coupe)"),nl,
   read(Type),nl,
   write("Which fuel do you prefer?"),nl,
   read(Fuel),nl,
   car(Carbrand,Type,Output1,Output2,Fuel),nl,
   write(Output1,Output2).

```

And is this the best logic for my needs? Or do you guys have any better idea to this?

---

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [October 1, 2021, 10:57am UTC](https://swi-prolog.discourse.group/t/stream-does-not-exist/4507/2 "2021-10-01T10:57:04Z")

</div>

> Stream does not exist

The reason for the error is from this line

```prolog
write(Output1,Output2)

```

write/2 - write(+Stream, +Term)

Output1 is unified with `tiguan` and then passed to write/2 which expects it to be a stream.

If you use two consecutive write/1 it should work, I.e.

```prolog
write(Output1),write(Output2).

```

* * *

> [@Jrdn40](#):
>
> And is this the best logic for my needs?

I prefer to use read\_string/5.

See StackOverflow answers. ([search](https://stackoverflow.com/search?q=%5Bprolog%5D+read_string%2F5+is%3Aanswer)).

If you want to get more involved then you can switch to parsing input with [DCGs](https://www.swi-prolog.org/pldoc/man?section=DCG) but your example doesn’t warrant that.

* * *

> [@Jrdn40](#):
>
> Or do you guys have any better idea to this?

See: [Best practices for printing](https://swi-prolog.discourse.group/t/best-practices-for-printing/4231)

* * *

HTH
