Greetings,
I copied this simple example from the Beginners page: OSProcess thisOSProcess stdOut nextPutAll: 'Hello World' Before running it, I did install the OSProcess OSProcess Pluggin packages. But I get an MessageNotUnderstood error browser. But I can't seem to figure out why stdOut is not understanding nextPutAll: Thanks for help. Tom Keller, Ph.D. 503-494-2442 6339b Basic Science Bldg _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
On Tue, Jul 18, 2006 at 11:19:56AM -0700, Thomas J Keller wrote:
> Greetings, > I copied this simple example from the Beginners page: > OSProcess thisOSProcess stdOut nextPutAll: 'Hello World' > > Before running it, I did install the OSProcess OSProcess Pluggin > packages. > > But I get an MessageNotUnderstood error browser. But I can't seem to > figure out why stdOut is not understanding nextPutAll: Hi Tom, OSProcess does not work on all platforms. If you are using Linux (or Mac OS/X with the less common Unix VM), the example should work. But if you are using Windows, it would not work unless you build your own custom VM and plugins (not what you had in mind, I'm sure). Almost everything in Squeak works identically on all platforms, but OSProcess is an exception to this rule. It is intended to provide platform-specific extensions, and it works differently (or not at all) on different platforms. As for troubleshooting, try playing around with the Squeak debugger. When you saw the "MessageNotUnderstood browser", you were seeing the debugger. Open in up and explore a little, and you'll be able learn a lot about problems like this one. You can also open a debugger right away and use it to step slowly through a problem to see where it goes wrong. For you example, try evaluating this in your workspace: self halt. OSProcess thisOSProcess stdOut nextPutAll: 'hello world' Hope this helps a little, Dave _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Thomas Keller-4
Still confused.
I'm running Squeak3.8-6665 on OS X v10.4. The debugger indicates nextPutAll: 'hello world' is the problem. But nextPutAll: should take a string as its argument. self halt also gives an error, with halt as an undefined object. sigh. Tom K On 7/18/06, Thomas J Keller <[hidden email]> wrote:
-- Tom "Ecrasez l'Infame!" -- Voltaire _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by David T. Lewis
Perhaps this is the problem?
When I ran this in a worksheet: a _ OSProcess thisOSProcess stdOut. Transcript show: a show: returned "nil" So nextPutAll: has no where to print to? So my next question is how do I find the systems STDOUT pid? Thanks, Tom K On 7/19/06, David T. Lewis <[hidden email]> wrote: On Tue, Jul 18, 2006 at 11:19:56AM -0700, Thomas J Keller wrote: -- Tom "Ecrasez l'Infame!" -- Voltaire _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Perhaps you could describe what you actually want to achieve.
Squeak is different from other programming environments. Some things are much easier, some are much harder than in other systems. In a way, Squeak pretends to be its own operation system (it indeed can run on bare hardware). That makes it harder to do a "hello world" that writes to the "other" operating system's stdout. Other things, like animated graphics or sound are much easier in Squeak than elsewhere. The Squeak "hello world" is simple to show that string on the Transcript. Or even better self inform: 'hello world' Note that working with Squeak is much more immediate than you might be used to. For example, you should just select "OSProcess thisOSProcess stdOut" and press Cmd-p to see the result, rather than logging it to the Transcript. Or, press Cmd-i to inspect it. You should learn to use the debugger - read what it actually says, and explore. For example, "UndefinedObject does not understand: #nextPutAll:" simply means you sent the message "nextPutAll:" to nil (an instance of class UndefinedObject), which cannot understand that message, and says so. Same thing with a "self halt": you do not get an error, the reddish window simply is a friendly debugger to examine the code about to be executed. - Bert - Am 20.07.2006 um 20:03 schrieb Thomas Keller: > Perhaps this is the problem? > When I ran this in a worksheet: > a _ OSProcess thisOSProcess stdOut. > Transcript show: a > > show: returned "nil" > So nextPutAll: has no where to print to? > > So my next question is how do I find the systems STDOUT pid? > > Thanks, > Tom K > > On 7/19/06, David T. Lewis <[hidden email]> wrote: On Tue, Jul > 18, 2006 at 11:19:56AM -0700, Thomas J Keller wrote: > > Greetings, > > I copied this simple example from the Beginners page: > > OSProcess thisOSProcess stdOut nextPutAll: 'Hello World' > > > > Before running it, I did install the OSProcess OSProcess Pluggin > > packages. > > > > But I get an MessageNotUnderstood error browser. But I can't seem to > > figure out why stdOut is not understanding nextPutAll: > > Hi Tom, > > OSProcess does not work on all platforms. If you are using Linux (or > Mac OS/X with the less common Unix VM), the example should work. But > if you are using Windows, it would not work unless you build your own > custom VM and plugins (not what you had in mind, I'm sure). > > Almost everything in Squeak works identically on all platforms, but > OSProcess is an exception to this rule. It is intended to provide > platform-specific extensions, and it works differently (or not at > all) on different platforms. > > As for troubleshooting, try playing around with the Squeak debugger. > When you saw the "MessageNotUnderstood browser", you were seeing > the debugger. Open in up and explore a little, and you'll be able > learn a lot about problems like this one. You can also open a debugger > right away and use it to step slowly through a problem to see where > it goes wrong. For you example, try evaluating this in your workspace: > > self halt. > OSProcess thisOSProcess stdOut nextPutAll: 'hello world' > > Hope this helps a little, > Dave _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Thomas Keller-3
On Thu, Jul 20, 2006 at 11:03:11AM -0700, Thomas Keller wrote:
> Perhaps this is the problem? > When I ran this in a worksheet: > a _ OSProcess thisOSProcess stdOut. > Transcript show: a > > show: returned "nil" > So nextPutAll: has no where to print to? Yes, that's exactly right. Your system cannot find its standard output (because it does not have the necessary platform-specific OSProcess plugin installed), so its standard output is nil. And nil is really an object, like everything else in Squeak. When you send the message #nextPutAll: to the nil object, the nil object responds by throwing a MessageNotUnderstood error (MessageNotUnderstood is also an object, you can find in in a browser if you like). The default response to a MessageNotUnderstood error is to open a debugger, which lets you poke around and figure out what went wrong. > So my next question is how do I find the systems STDOUT pid? There are several ways to answer this, so let me start by taking the question literally. With the VM and plugins you are currently using, you cannot see either the pid of the process that Squeak is running in, or the identity of the STDOUT steam. But not to worry, you probably don't really need either of these. It may seem odd at first, but try to think of Squeak as a self contained object environment, rather than as a program that does I/O to STDOUT and to files. The Transcript usually plays the role of STDOUT in the sense that you can evaluate things and show the result on the Transcript. Even more commonly, you can evaluate an expression (which may invoke some computation of arbitrary complexity), and "inspect it" to see the results directly. But back to being literal. If you really want to see the pid of the current Squeak process, and to have access to the STDOUT, STDIN, and STDERR streams, then you need to run your Squeak image with a virtual machine that has the OSProcess plugin extension. You can get this from http://www.squeakvm.org/unix/. If you install the MacOSX VM from this page, it will provide the OSProcess plugin, and if you run your Squeak image with this VM, it should do exactly what you want. I'm glad that you are interested in OSProcess, because I wrote it. But what I really hope is that you will quickly discover that OSProcess is completely unnecessary for almost everything you will want to do in Squeak. In my own experience, the more I became comfortable with Squeak, the less I worried about traditional file I/O and the like. It's nice to be able to do that stuff (hence the OSProcess extensions), but it's rarely needed once you get comfortable with the Squeak environment. Dave _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
David,
That is very interesting. Thanks. I am just getting the start of the sensation you describe. Perhaps astronauts have the same problem getting used to weightlessness. Thanks again. Tom Keller On 7/22/06, David T. Lewis <[hidden email]> wrote: On Thu, Jul 20, 2006 at 11:03:11AM -0700, Thomas Keller wrote: -- Tom "Ecrasez l'Infame!" -- Voltaire _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |