Hi Jonathan,
Yes I know textfile "works" but I can't put any kind of object behind
this Texfile.
I'll try all list object and this the same problem.
Look this :
http://www.th-th.fr/DOCS/Patch/bug-texfile.pd
I need to read this line with float at the begining but I can't.
So I think we will take a script to do this because textfile can't do this.
Thanks for your help
Thomas
Jonathan Wilkes a écrit :
The problem occurs because Pd has several built-in message types, and
the float message is one of them.
Pd expects any message that has the "float" selector to have one
argument, and that argument should be a
float-atom (e.g., "float 1"). So if you type "float foo" in a message
box and click it, Pd complains about
"bad arguments" because (I think) when the message box tries to parse
the message, it sees the "float"
selector and thus expects a number for the argument, but instead it gets
the symbolic-atom "foo."
In your example patch, if you disconnect all the objects from the outlet
of [textfile] and click
the [bng], you'll notice that you don't get an error. I would take this
to mean that [textfile] does its
job-- its just that once you try to do anything with the message "float
toto 0 1 2" by connecting
[textfile]'s outlet to another object, Pd will catch the badly formed
message and report an error.
(On the other hand, if your example text file had the line "float 3 0 1
2," the first argument ("3") would be
the right type of atom, so Pd would just silently truncate
everything after the first argument. But you'd still get an error from the
right inlet of [select float] because, ironically, by making the first
argument of [select] the word
"float" instead of a float-atom like "3," you are instantiating a
[select] object that expects symbol
messages and not floats.)
As far as a solution, you could begin each line of your text file with
the selector "list", or a word that
is not the selector of Pd's builtin messages. If you're reading in
arbitrary data and you can't control
whether each line starts with something that could be confused for a
built-in Pd message type, I'm not sure
what the best solution is.
-Jonathan
------------------------------------------------------------------------
*From:* Pedro Lopes <[email protected]>
*To:* matohawk <[email protected]>
*Cc:* pd-list <[email protected]>
*Sent:* Tue, June 29, 2010 6:49:44 PM
*Subject:* Re: [PD] Problem with Textfile and line with float
humm.. I see what you mean now. It gives a error with the float argument
when it arrives at the objects after the textfile. I'm trying to figure
out the reason for that.
On Tue, Jun 29, 2010 at 11:42 PM, Pedro Lopes <[email protected]
<mailto:[email protected]>> wrote:
I did that, but what are you expecting your patch to do?
Should it send each object read from text file separately?
'Cause here (with the patch I explain in my previous reply) the
textfile reads your file and outputs all the values to a [print
list] so then its just a matter of manipulating that into what you want.
I used your file for the tests. I can try to look and guess what do
you intend, but its probably less ambiguous if you explain the
purpose. :)
Best of luck,
Pedro
On Tue, Jun 29, 2010 at 11:36 PM, matohawk <[email protected]
<mailto:[email protected]>> wrote:
Hi Pedro,
Sorry I think I'm not very with explanation.
I know how textfile works it's not my problem
Have a look of this patch and textfile, it's better to
understand the problem:
http://www.th-th.fr/DOCS/Patch/bug-texfile.pd
http://www.th-th.fr/DOCS/Patch/text-float.txt
Download the twho files, open the patch and click on bang
Cheers,
Thomas
Pedro Lopes a écrit :
I'm not following the "concept" behind your code.
Notice that you can connect a message box "print" and send
that command to textfile. And it reads your file to the pd
shell correctly.
[read your-file.txt]
| [print( <-- this is a message
| /
|/
| [bang] <-- hit this to read,.
| /
|/
[textfile]
|
|
[print list]
And it works. Take a look at the help file, it shows hot to
use it. I hope I'm understanding your issue, if not,
hopefully someone does :)
Best of luck,
Pedro
p.s: remember to use the "rewind" message to textfile,
because otherwise it doesn't read the line again! Because it
moves forward with the seek file pointer.
On Tue, Jun 29, 2010 at 10:37 PM, thomas thiery
<[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>> wrote:
Hi pd-list,
test this patch, I saw a curious problem. I need to read
line with
"float" at the begining of a line and textfile can't do this.
It's a pity
-- Matohawk alias Th-Th
www.th-th.fr <http://www.th-th.fr/> <http://www.th-th.fr>
_______________________________________________
[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>> mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
--
Pedro Lopes
contacto: [email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>
website: http://web.ist.utl.pt/Pedro.Lopes
_______________________________________________
[email protected] <mailto:[email protected]> mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list
--
Pedro Lopes
contacto: [email protected] <mailto:[email protected]>
website: http://web.ist.utl.pt/Pedro.Lopes
--
Pedro Lopes
contacto: [email protected] <mailto:[email protected]>
website: http://web.ist.utl.pt/Pedro.Lopes
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list