Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import name 'Adapter' from 'pylogix' #207

Open
1 of 7 tasks
meenavinod opened this issue Oct 31, 2022 · 23 comments
Open
1 of 7 tasks

cannot import name 'Adapter' from 'pylogix' #207

meenavinod opened this issue Oct 31, 2022 · 23 comments

Comments

@meenavinod
Copy link

meenavinod commented Oct 31, 2022

Preflight checks

Before you post an issue, ensure you have tried the minimal examples within the repo, or tried the pylogix-tester.

Type of issue

Import Error

  • Bug
  • Feature Request
  • Question
  • Other

Delete items that do not apply below.

Description of issue

Unable to Start Pylogix Adaptor

Expected behavior

Actual behavior

Code

Please provide a minimal, reproducible example

Screenshots

Stacktrace

Versions

Include versions to

  • pylogix:
  • python:
  • OS:
    image
@TheFern2
Copy link
Collaborator

Pylogix does not have an Adapter class to my knowledge, on which example did you see Adapter being imported?

  • What are you trying to do?

@dmroeder
Copy link
Owner

Pylogix does have an Adapter class, but only in the experimental branch. Since this is not in the main branch, you must download the project from here on GH, then switch to the experimental branch.

@TheFern2
Copy link
Collaborator

Ah ooppss, sorry for the wrong information, wasn't aware of it until now.

@TheFern2
Copy link
Collaborator

TheFern2 commented Nov 1, 2022

Did you posted a comment and accidentally deleted? I see it on the notifications but is not here.

@meenavinod
Copy link
Author

Hi,
Thanks for very much for quick responses. I tried the above suggestions and finally this issue looks fine but I am still unable to communicate with PLC. I am still facing below issues -

  1. Unable to restore L5X file to ACD.
    image

  2. I tried to incorporate L5X changes to my test project but still no connectivity with adapter
    image
    Can you please provide the ACD file with example..?

@dmroeder
Copy link
Owner

dmroeder commented Nov 2, 2022

The L5X is the I/O adapter, not a complete program. You would import it into the I/O tree of your existing program.

@meenavinod
Copy link
Author

I tried to import L5X IO adapter as ENBT child module. I made some correction to add as a remote child module of ENBT. My project IO tree have adaptor module as above.
Please let me know if I did anything wrong..?

@dmroeder
Copy link
Owner

dmroeder commented Nov 2, 2022

Logix is probably being picky because I exported the module from a CompactLogix. I'm guessing that it doesn't like importing to the ENBT. Your image above doesn't tell me how you configured the module. The example expects that you configured it like the image:
https://github.com/dmroeder/pylogix/blob/experimental/examples/100_simple_adapter.png

The adapter in the I/O tree needs the IP address of the machine that will be running the pylogix adapter. And your adapter script needs to be configured for your ENBT's IP address. If that is not working, post a screenshot of your I/O adapter configuration, you exact python script and your IP adddresses.

@meenavinod
Copy link
Author

Hi, When i tried to import L5X to my project file, its giving error of parent module
image

I believe adapter cant be added as Local, so I changed the parent module properties in L5X file and import again as child of ENBT
image

I used same IP address as per example and used same script to run the adapter
image
image

Still PLC and Adapter unable to connect...

@dmroeder
Copy link
Owner

dmroeder commented Nov 3, 2022

As I mentioned, Logix is not letting you import the module because it is terrible. I had the module in a CompactLogix, you have a ControlLogix, it is not smart enough to disregard that difference, unfortunately :)

Is your computer's network adapter configured for the IP Address 192.168.1.23? Is your ENBT's IP Address 192.168.1.10?

@meenavinod
Copy link
Author

Yes, IP is same as above. Its able to detect hostname correctly ...
image

@dmroeder
Copy link
Owner

dmroeder commented Nov 3, 2022

Can you capture it via wireshark and email the result to me?

I do have a ControlLogix and ENBT, though I won't be able to test until Friday.

Edit: My instinct is that there is some confusion on network adapters, I'd probably try disabling all unnecessary adapters. When you run your script, is there any error or any feedback?

@meenavinod
Copy link
Author

image

@dmroeder
Copy link
Owner

dmroeder commented Nov 3, 2022

Is your script running in that instance? All I see is list identity, which is not pylogix, it is probably RSLinx. To minimize wireshark traffic, shut down RSLinx and LogixDesigner. Run Wireshark, run your script.

Edit: Wait, why does your generic adapter report that is a Rockwell device? Something else is going on here, like another Rockwell device at the .23 address? The pylogix adapter has not implemented the services that would respond to the request that the module info tab would send.

@meenavinod
Copy link
Author

meenavinod commented Nov 3, 2022

image
image

Without RS Linx and Adapter Script running

@dmroeder
Copy link
Owner

dmroeder commented Nov 4, 2022

Here is the problem I'm having. You show the screenshot of your generic module's Module Info tab, it is reporting a Rockwell Software Communication Adapter. You are telling me that your computers IP address is 192.168.1.23 and that generic module is configured for 192.168.1.23, which looks to be the case and that would be correct.

There's something up with your screenshot though. When you open the Module Info of your generic module, it is sending out a List Identity request to the address of 192.168.1.23. Some Rockwell device is responding. If it is your computer that is configured for 192.168.1.23, and it should be based on your script, nothing should respond. The only thing that should be at .23 is your computer, which would not respond to a List Identity request.

@dmroeder
Copy link
Owner

dmroeder commented Nov 4, 2022

Wait, can you go to the Network and Sharing Center and check if your adapter is set to "public network"?

I had trouble with this, the firewall was blocking the connect request from the PLC.

@meenavinod
Copy link
Author

I believe its reporting a Rockwell Software Communication Adapter because of RS Linx. If I change the IP address of my computer its unable to find module properties -
image

My network and sharing center already was in Public network but Firewall Defender was on. After disabling it After disabling the Firewall defender for Public network -
image

@dmroeder
Copy link
Owner

dmroeder commented Nov 5, 2022

Okay, you are getting close. I don't think RSLinx would cause what you were seeing but maybe RSlinx Enterprise, I can't say for sure. The timeout is what I would expect because the pylogix adapter hasn't implemented the list identity response.

You may have some more firewall work to do. I think there should be a register session, which I don't see. After both the register session and forward open, the connection switches to UDP, port 2222.

@meenavinod
Copy link
Author

I Think its registering the session but Forward Open connection failed...

I have disabled firewall completely .

image

@dmroeder
Copy link
Owner

dmroeder commented Nov 5, 2022

Can you email me that wireshark packet capture? What's odd about your capture is that the forward open response, which should be coming from pylogix is the wrong size, which makes me think that there is something else responding.

Edit: Edit line 388 in adapter.py: CIPVendorID = 0x1337

Then run that capture and send it to me.

@meenavinod
Copy link
Author

Hi, You are right, I didnt noticed any change with Adapter Script running or not in Wireshark. Can you please share your mail address. my email is [email protected].
image

image

image

But the Pylogix eip working as expected with same setup.
image

@lbhopper
Copy link

have you tried disabling keys in your Adapter Module? ControlLogix modules can return with errors if keying is set to exact or compatible:

https://literature.rockwellautomation.com/idc/groups/literature/documents/at/logix-at001_-en-p.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants