Skip to content

Conversation

@alexandrecuer
Copy link
Contributor

with :

  • signal to stop gracefully
  • asyncio.run() to make it easier for people who don't know much about asyncio

with :
- signal to stop gracefully
- asyncio.run() to make it easier for people who don't know much about asyncio
@janiversen
Copy link
Collaborator

This looks good, I will review it soon. Would you like to add another PR that updates the general fowarder with your signal and async,run idea ?

@janiversen
Copy link
Collaborator

janiversen commented Oct 16, 2022

Please solve the pylint/flake8 error.

@janiversen
Copy link
Collaborator

you can run the checks locally:
tox -e pylint
and
tox -e flake8

@janiversen
Copy link
Collaborator

please do not suppress pylint messages ! they are there for a reason.

@alexandrecuer
Copy link
Contributor Author

I just left the # pylint: disable=unused-argument which is necessary for the graceful shutdown to work

if it is not acceptable, I will delete the pull request

@janiversen
Copy link
Collaborator

I just left the # pylint: disable=unused-argument which is necessary for the graceful shutdown to work

if it is not acceptable, I will delete the pull request

I have not done a review yet I am primarily waiting to CI to give green light, and I am not sure why you threaten to delete the PR !

unused-argument can easily be avoided and I hardly believe the graceful shutdown depends on a pylint disable !

That being said unused-argument is something we accept if there are a good reason to have it.

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks quite good, but there are a couple of formal issues.

usage :
python3 serial_forwarder.py --log DEBUG --port "/dev/ttyUSB0" --baudrate 9600 --server_ip "192.168.1.27" --server_port 5020 --slaves 1 2 3

sudo python3 serial_forwarder.py --port "/dev/ttyUSB0" --baudrate 9600 --server_ip "192.168.1.27" --server_port=502 --slaves 1 2 3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a duplicate, please remove. If the code needs a sudo something needs to be corrected.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To what i know, the default Modbus port number is 502

if you want to run on port 502, you need to use sudo

Ports below 1024 are restricted - only apps with root privileges can listen on those. I think this is the general rule on Linux/Unix

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are quite right depending on which system you are on. But independent you have already documented how to call it, so there are really no need to repeat it.

@alexandrecuer
Copy link
Contributor Author

unused-argument can easily be avoided and I hardly believe the graceful shutdown depends on a pylint disable !

That being said unused-argument is something we accept if there are a good reason to have it.

I dont know a better and more appropriate way to do it but if you know one, I am interested

I have a similar problem when using click in some projects. Pylint is not happy and I have to add # pylint: disable=no-value-for-parameter

@janiversen janiversen merged commit 877021c into pymodbus-dev:dev Oct 17, 2022
@janiversen
Copy link
Collaborator

Thanks for the PR, please keep more coming.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants