TCL script with http under Hypermesh

Altair Forum User
Altair Forum User
Altair Employee
edited November 2021 in Community Q&A

Hi,

I have a simple script :


package require http;
set myurl 'http://mysite/file.txt';

proc getPage { url } {
set token [::http::geturl $url]
set data [::http::data $token]
::http::cleanup $token
return $data
}

set file [ getPage $myurl ]
puts '$file'

With TCL 8.5 under Windows 7, I can run this script without problem.

But when I try to run under Hypermesh session (via : source ....) I got error message :

 

========================================

Main console display active (Tcl8.5.9 / Tk8.5.9)

(hw13) 1 % source C:/Users/MYNAME/test.tcl

couldn't open socket: invalid argument

========================================

 

I don't know why this script does not work under Hypermesh.

 

Any idea for help ?

 

Thanks,

 

UPDATE: it works well when I try command line within cmd window:


'C:\Program Files\Altair\13.0\hw\tcl\tcl8.5.9\win64\bin\tclsh85.exe' test.tcl

Answers

  • tinh
    tinh Altair Community Member
    edited September 2015

    Hi Mr Quy

    I try with hm12 and it worked

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited September 2015

    Hi Mr Quy

    I try with hm12 and it worked

     

    Really? I have removed HM12 some month ago.

    I'm waiting for release 14 now.

  • Merula_20758
    Merula_20758 Altair Community Member
    edited October 2015

    I tried it both in 12 and 13 and neither of them works for me... same error in 12.

    Also tried it with adminstator rights... no success. But I still think its some permisson error....

     

    Best regards,

    Merula

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2015

    WORKAROUND: the same task is written by Perl. From TCL, use 'exec ...'.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2020

    Hello I'm getting this error stating 'Main console display active (Tcl8.5.9 / Tk8.5.9)
    (Documents) 1 % '

  • tinh
    tinh Altair Community Member
    edited April 2020

    Hello I'm getting this error stating 'Main console display active (Tcl8.5.9 / Tk8.5.9)
    (Documents) 1 % '

    It is not error message. It is headlines of tkconsole

     

  • Abdul Muizz Jamal
    Abdul Muizz Jamal Altair Community Member
    edited November 2021

    Hello I'm getting this error stating 'Main console display active (Tcl8.5.9 / Tk8.5.9)
    (Documents) 1 % '

    It is not error message. It is headlines of tkconsole

     

    But how to remove it?? I can't open the Countours Tab to view the results. I am having this same issue
  • BenGoba
    BenGoba Altair Community Member
    edited November 2021

    We've had luck with the Windows 'start' command to load Word files and URLs from within the HyperMesh TCL environment.  If you are still facing the issue, you can try something similar to:

    exec cmd /c start "https://altair.com"

     

    Hopefully letting Windows handle opening the page will work better.