Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Enthusiast Zone > Classic Macs and Mac OS > AppleScript CGI Errors...

AppleScript CGI Errors...
Thread Tools
l008com
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Jan 24, 2002, 01:53 AM
 
I'm running an AppleScript as a CGI in personal web sharing on 8.1. Now when the call for the following subroutine is commented out, the cgi runs no prob. When it is left in there, the CGI does not run, and it gives errors like bad gateway, sometimes it just times out. Its very odd. So here is the problem code, can anybody see the problem, it looks perfect to me, I can't find one problem. Also, is there something 'special' you have to know about running AppleScript's as CGI's in classic? I've never had any troubles before, but that could have been luck I suppose.
Here is the questionable subroutine...
     
BLAZE_MkIV
Professional Poster
Join Date: Feb 2000
Location: Nashua NH, USA
Status: Offline
Reply With Quote
Jan 24, 2002, 09:13 PM
 
Originally posted by l008com:
<STRONG>I'm running an AppleScript as a CGI in personal web sharing on 8.1. Now when the call for the following subroutine is commented out, the cgi runs no prob. When it is left in there, the CGI does not run, and it gives errors like bad gateway, sometimes it just times out. Its very odd. So here is the problem code, can anybody see the problem, it looks perfect to me, I can't find one problem. Also, is there something 'special' you have to know about running AppleScript's as CGI's in classic? I've never had any troubles before, but that could have been luck I suppose.
Here is the questionable subroutine...
</STRONG>
I use the alias when you read and write to the file not the result of the open for access command

set specialile to alias "______________"
set specialfile_ref_num to open for access specialfile with write permission

then ignore specialfileref
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Jan 24, 2002, 09:31 PM
 
According to the reference, the result returned from the open command is a file reference number than can be used as the 'object' of all the read, write and oef commands... Since I have no other ideas though, i'm going to try it manually anyway and see if it works....
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Jan 24, 2002, 09:38 PM
 
OK I tried it with all the specialfile's written out with the full pathname, and it still gave a 502 error, both ways should work, so the problem must be something else.
     
BLAZE_MkIV
Professional Poster
Join Date: Feb 2000
Location: Nashua NH, USA
Status: Offline
Reply With Quote
Jan 25, 2002, 06:03 PM
 
My only other suggestions would be a try block to see what the error is. That or there is the trick for debugging release code were you put in dialog boxes in to find out where the error is by which was last before the crash.
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Jan 25, 2002, 07:53 PM
 
i tried the Try error handler and having it display the error, adn much to my surprise, the script itself never got an error. The dialog debugging idea is good, but i'd use simple 'beep's and count them, which I actually did at one point, but for the sake of me figuring this out, jsut forget I even said that, maybe i'll try it again later.
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Jan 26, 2002, 04:04 PM
 
OK I've made a little headway...

Now after really dissecting this thing, it seems to have trouble, but not get an error, on the 'read' line Now when I think back to the first time I write this same script and had it running, I think I set it up a little differently, and didn't use 'read' from file at all. Is there something special about the read function, something you have to do to get it to work? Or something specifically you have to do to get it to work when in a CGI?
     
BLAZE_MkIV
Professional Poster
Join Date: Feb 2000
Location: Nashua NH, USA
Status: Offline
Reply With Quote
Jan 26, 2002, 06:06 PM
 
I haven't done any coding of CGI's just normal applescript stuff. The only thing i can see about the read line that could be the problem is the assumption of length of the file. If it isn't long enough then you could get an non result from the read operation.
     
l008com  (op)
Addicted to MacNN
Join Date: Jan 2000
Location: Stoneham, MA, USA
Status: Offline
Reply With Quote
Jan 26, 2002, 06:13 PM
 
The file in question is a specific log file that IS longer, and 438 is a specific spot in that file where I wanna insert new data. Similar applescripts work fine as regular apps, its just when I run them as CGI's they don't work.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 02:42 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,