pyxbgen Issue / Module PPv16 generation Issue

326 views
Skip to first unread message

XIAO ZHANG

unread,
Jan 6, 2023, 12:53:25 PM1/6/23
to A gathering place for the Open Rail Data community
Hi,

I'm trying to connect to National Rail Open data using the python codes and process from https://github.com/openraildata/stomp-client-python#readme.

I have checked that the stomp.py and pyxb modules are installed on my windows laptop and the versions are up to date.

When I try to run codes:
 "pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd"
I received an error message "SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?"

I have also tried codes:
"pyxbgen -m PPv16 -u rttiPPTSchemav16.xsd"
Then I received an error message "SyntaxError: invalid syntax"

For more information:
I used the following codes:
Capture.PNG

And my folder looks like this:
Capture1.PNG

I'm not sure where the problem is. Can anyone help, please?

Any help would be very much appreciated.

Thanks
Joyce

Peter Hicks (Poggs)

unread,
Jan 6, 2023, 2:26:07 PM1/6/23
to openrail...@googlegroups.com
Hi Joyce

> On 6 Jan 2023, at 13:25, XIAO ZHANG <joyce...@gmail.com> wrote:
>
> When I try to run codes:
> "pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd"
> I received an error message "SyntaxError: cannot assign to expression here. Maybe you meant '==' instead of '='?"
>
> I have also tried codes:
> "pyxbgen -m PPv16 -u rttiPPTSchemav16.xsd"
> Then I received an error message "SyntaxError: invalid syntax”

Thank you very much for including the screenshots! I thought this was a problem running on Windows at first, but it looks like you’re trying to run pyxbgen within the Python environment.

pyxbgen is a system command. It gets installed when you run ‘pip install -r requirements.txt’ as part of PyXB.

Having tried this on macOS with Python 3.10, pyxbgen throws a couple of warnings:

% pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/Alarms/v1}RTTIAlarm.{http://www.thalesgroup.com/rtti/PushPort/Alarms/v1}set renamed to set_
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/Forecasts/v3}TSLocation.{http://www.thalesgroup.com/rtti/PushPort/Forecasts/v3}pass renamed to pass_
WARNING:pyxb.binding.generate:Element use {http://www.thalesgroup.com/rtti/PushPort/TrainOrder/v1}TrainOrder.{http://www.thalesgroup.com/rtti/PushPort/TrainOrder/v1}set renamed to set_
Python for http://www.thalesgroup.com/rtti/PushPort/v16 requires 16 modules

It works fine. On Python 3.11, it fails:

AttributeError: module 'collections' has no attribute 'MutableSequence'

I’ll open a bug on the GitHub project to record this, so it’s visible.

Let us know how you get on!

Best wishes,


Peter





XIAO ZHANG

unread,
Jan 6, 2023, 6:40:55 PM1/6/23
to A gathering place for the Open Rail Data community
Hi Peter,

Thank you very much for looking into this issue.

To be honest, I'm quite new to Python, so I'm not quite sure what you meant by 'pyxbgen is a system command". When trying to run the codes 'pyxbgen --schema-root=ppv16 --module PPv16 rttiPPTSchema_v16.xsd' via cmd directly, I received the following error:
4.PNG

I should have mentioned that I did run the codes 'pip install -r requirements.txt’ prior to everything I sent in my initial post. Please see the screenshot below, which states that the stomp.py and PyXB modules/packages are already installed.
1.PNG

In my initial post, in the python environment, when I code 'import pyxb', no error occurred, so I would expect that I did install the module pyxb beforehand.
Also, I managed to find a pyxbgen file in one of my folders, the extension of this file is somehow generic. Unfortunately, I have no idea how to run this file.
2.PNG

I'm using windows 10 and Python 3.10, and the pyxb version I installed on my laptop is 1.2.6.
3.PNG
 
Unfortunately, both my work and personal laptops have windows systems, I can't run the codes in other systems.

Could you please provide some further guidance?

Thanks
Joyce

Peter Hicks

unread,
Jan 7, 2023, 6:54:39 AM1/7/23
to openrail...@googlegroups.com
Hi Joyce

When I say 'system command', I mean it's executed from your operating system's command prompt ('cmd.exe') rather than from within Python.  From what I can see, your command prompt can't find it, so it may not be on your path (a set of directories that the command prompt will look for an executable in, if it's not in the current directory).

Digging down further, the 'pyxbgen' file that I have is actually Python code rather than an actual compiled binary, so you might be able to run 'python pyxbgen...' rather than just 'pyxbgen'.  Maybe open 'pyxbgen' on your machine in a text editor and see if it's actually Python code.


Peter


--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openraildata-talk/1c6db448-c54e-4ea5-9149-5c18b4eee353n%40googlegroups.com.

XIAO ZHANG

unread,
Jan 8, 2023, 1:13:32 PM1/8/23
to openrail...@googlegroups.com
Thanks again, Peter.

It looks like the 'pyxbgen' file does have Python codes in it.
new.PNG

I also tried executing 'python pyxbgen' from the operating system's command prompt, unfortunately, received the following error message.
1.PNG

Joyce


XIAO ZHANG

unread,
Jan 8, 2023, 6:29:38 PM1/8/23
to openrail...@googlegroups.com
Hi Peter,

I just realized that the error I received - AttributeError: module 'collections' has no attribute 'MutableSequence' when running "python pyxbgen' is the same as the one you received when running Python 3.11 on macOS. Do you think there's any workaround for this?

Xiao

Peter Hicks

unread,
Jan 22, 2023, 9:03:10 AM1/22/23
to A gathering place for the Open Rail Data community
Hi Xiao

The easiest workaround is probably to go to an earlier Python version.  Maybe it's an issue or a breaking change with the new version of Python and pyXB.


Peter


Volodymyr Lopushko

unread,
Jun 12, 2024, 5:38:03 AMJun 12
to A gathering place for the Open Rail Data community
I have an identical issue with Python 3.10

Peter Hicks (Poggs)

unread,
Jun 12, 2024, 7:42:35 AMJun 12
to A gathering place for the Open Rail Data community
Hello

On 12 Jun 2024, at 10:32, Volodymyr Lopushko <v.lop...@gmail.com> wrote:

I have an identical issue with Python 3.10

Can you try again with the latest code at https://github.com/openraildata/stomp-client-python please?  I’ve just updated it to use a later version of PyXB-X which supposedly fixes this issue.


Peter
Reply all
Reply to author
Forward
0 new messages