Error testing the WebHMI

52 views
Skip to first unread message

nicolas.ard

unread,
Apr 11, 2011, 4:02:19 PM4/11/11
to modbus-tk
Hello there,
I have a device that have a Modbus TCP/IP server working good in port
8000.
I tried to put WebHMI in work, adding the device with the format
IpAdress:Port, and some variable to see, but when i clicked in "view"
it don't work.

I got the message (In the browser), (url: http://localhost:8075/modbus-read/5/1/3/200/16
)

[START MESSAGE]
Error 500: Internal Server Error

Sorry, the requested URL http://localhost:8075/modbus-read/5/1/3/200/16
caused an error:

Unhandled exception
[END MESSAGE]

in the console i got the message
localhost - - [11/Apr/2011 16:58:49] "GET /modbus-read/5/1/3/200/16
HTTP/1.1" 500 716

I have never used bottlepy, but i think that it's a problem with it.

Thanks

Cheers

Nicolas Ardison
Lanus, BA - Argentina

Luc JEAN

unread,
Apr 12, 2011, 1:14:08 AM4/12/11
to modb...@googlegroups.com
Hello Nicolas,
The webhmi is somehow an experimental feature. It may have some troubles.
Can you try to modify the show_results function in master_webhmi.py and catch all exceptions. It will help you to understand what's wrong.
I hope it helps
Best
luc

2011/4/11 nicolas.ard <nicol...@gmail.com>



--
http://www.apidev.fr

Ardison Nicolas

unread,
Apr 15, 2011, 2:57:53 PM4/15/11
to modb...@googlegroups.com
Hi Luc, thanks for your reply,
I found the bug, it's a problem with variable types, in the "Master" class

class Master:
    def __init__(self, protocol, address, id, db):
        
        if protocol == "tcp":
            
            try:
                (host, port) = address.split(":")
                 self.modbus = modbus_tcp.TcpMaster(host, port)

The variables in red must be casted, the host to string and the port to int. (Really only the port to int, because the split() function returns a array of strings, but to keep the thinks clear i put the cast in both variables.

So here it's the class solved.
class Master:
    def __init__(self, protocol, address, id, db):
        
        if protocol == "tcp":
            
            try:
                (host, port) = address.split(":")
                 self.modbus = modbus_tcp.TcpMaster(str(host), int(port))

Now works good, i'm using Python 2.6.4
--
Nicolas G. Ardison
nicol...@gmail.com

Antes de imprimir este mensaje, asegúrese de que es necesario. El medio ambiente está en nuestras manos.
Before printing, think about the environment.

luc

unread,
May 24, 2011, 9:17:04 AM5/24/11
to modbus-tk
Hello Nicolas,

Sorry for late answer.

I finally find a little time to integrate your fox. Thanks a lot.

Best Regards

On 15 avr, 20:57, Ardison Nicolas <nicolas....@gmail.com> wrote:
> Hi Luc, thanks for your reply,
> I found the bug, it's a problem with variable types, in the "Master" class
>
> class Master:
>     def __init__(self, protocol, address, id, db):
>
>         if protocol == "tcp":
>
>             try:
>                 (host, port) = address.split(":")
>                  self.modbus = modbus_tcp.TcpMaster(host, port)
>
> The variables in red must be casted, the host to string and the port to int.
> (Really only the port to int, because the split() function returns a array
> of strings, but to keep the thinks clear i put the cast in both variables.
>
> So here it's the class solved.
> class Master:
>     def __init__(self, protocol, address, id, db):
>
>         if protocol == "tcp":
>
>             try:
>                 (host, port) = address.split(":")
>                  self.modbus = modbus_tcp.TcpMaster(str(host), int(port))
>
> Now works good, i'm using Python 2.6.4
>
> On 12 April 2011 02:14, Luc JEAN <luc.j...@gmail.com> wrote:
>
>
>
>
>
>
>
>
>
> > Hello Nicolas,
> > The webhmi is somehow an experimental feature. It may have some troubles.
> > Can you try to modify the show_results function in master_webhmi.py and
> > catch all exceptions. It will help you to understand what's wrong.
> > I hope it helps
> > Best
> > luc
>
> > 2011/4/11 nicolas.ard <nicolas....@gmail.com>
>
> > Hello there,
> >> I have a device that have a Modbus TCP/IP server working good in port
> >> 8000.
> >> I tried to put WebHMI in work, adding the device with the format
> >> IpAdress:Port, and some variable to see, but when i clicked in "view"
> >> it don't work.
>
> >> I got the message (In the browser), (url:
> >>http://localhost:8075/modbus-read/5/1/3/200/16
> >> )
>
> >> [START MESSAGE]
> >> Error 500: Internal Server Error
>
> >> Sorry, the requested URLhttp://localhost:8075/modbus-read/5/1/3/200/16
> >> caused an error:
>
> >> Unhandled exception
> >> [END MESSAGE]
>
> >> in the console i got the message
> >> localhost - - [11/Apr/2011 16:58:49] "GET /modbus-read/5/1/3/200/16
> >> HTTP/1.1" 500 716
>
> >> I have never used bottlepy, but i think that it's a problem with it.
>
> >> Thanks
>
> >> Cheers
>
> >> Nicolas Ardison
> >> Lanus, BA - Argentina
>
> > --
> >http://www.apidev.fr
>
> --
> Nicolas G. Ardison
> nicolas....@gmail.com
Reply all
Reply to author
Forward
0 new messages