Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Expect/TCL:Cannot read the script file from GUI

Posted by skumar003 (skumar003), 5 February 2003
I have this telnet  application which runs this way.
at the command line >execute host scriptfile.

Now I am trying to do the same thing from the GUI at the click of a button.
FRom the GUI code I (function run) I call execute & soon after If i say source the script file it runs fine. But If I specify the script file at the textbox  on the GUI it cannot read the file. Connection to host is not a problem. It does not read the script file hence ultimate goal is not met.

I am not sure How clear I am being here. Can U please suggest.

Cheers,


Posted by admin (Graham Ellis), 6 February 2003
Questions

Have you checked that the file name that you get back from the GUI text entry box contains the text that you expect, or could it have an extra space or something in it?

Have you checked that your original script runs under wish just as it did under Tcl - in other words, is the problem wish related, or related to the variables and code you have written?

Have you considered updateideltasks to ensure that the GUI gets a lookin - is it possible that your appliaction is running, but you're just not seeing the answers>

I would proceed with further testing on this one, dividing the problem down until it became clearer what was going on ... which in turn should point you towards a solution

Posted by skumar003 (skumar003), 6 February 2003
After fixing a few things Now I get the following error.

error reading "file7": illegal operation on a directory

I rerun & Ii get the same error with "file9" and run again thefile becomes "file11" and so on......

I know I am not passing "file" anywhere in the code. This is some internal error flag.

Can U tell what is going on?

Regards,



Posted by skumar003 (skumar003), 7 February 2003
The problem is with an extra space at the input(textbox). hence it cannot read the file. Can U suggest why this extra space is created at the text box and it is getting passed with the space.

While typing in the text box U can begin without any space, but as soon as mouse click is done to execute the first letter shifts by 1 space.

Please suggest.

Posted by admin (Graham Ellis), 7 February 2003
I expect that the extra space is added by a command, configuration, event, or textvariable in your code.  Tk uses events; when an event occurs, the code that's programmed to the even runs without you making any explicit call.

"Quick and dirty" idea .... use string trim to get rid of the excess space - NOT a good solution in the longer term but it will prove if an extra space truely is causing your problem

You also asked about file9 file11 and things like that.  Not sure if things have moved on for you now, but in case they haven't (or in case others are interested ....)

When you open a file, it returns a "channel" which you save into a variable:
     set  fchan [open myfile.txt r]
The fchan variable contains a "handle" through which you can access the file in commands like read and gets ... you really shouldn't use the contents for other purposes.  However, all variables in Tcl are text strings and so even a channel is a string of text, and it happens often to be the word file followed by a number.   So the message you saw tells me that you're looking at file channels as if they were normal variables.  The fact that the number seems to be increasing tells me that you're possibly not closing your files properly, or that you're intentionally opening a lot of files at the same time.



This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho