Keyboard Shortcuts
Likes
- Jmriusers
- Messages
Search
Re: Add default consist to train
#operationspro
Dan,
?I will give it a try. ?I will need to drop the loco consist prior to the train going back into staging at the end of the route.
? |
Re: How do I import openpyxl?
Nick, What are you trying to do? ?
These Jython programs refer to CSV files:
TurnoutStatePersistence.py is a good example. ?When JMRI is stopped, the current turnout states are written to a CSV file. ?After starting and loading the xml data file, the script is run to set the turnouts to the previous state. Note: ?CSV (comma separated values), not CVS. Dave Sand ----- Original message ----- From: "Nick Brownsberger via groups.io" <nbrownsbe=[email protected]> Subject: Re: [jmriusers] How do I import openpyxl? Date: Thursday, May 22, 2025 11:38 AM Thanks all. Is nothing simple anymore? - I'm looking at Apache POI but the download process confusing. - Dave, Can you suggest some cvs examples? I looked in the Jython folder but none were obvious. ? Nick ? ? |
Re: How do I import openpyxl?
For reading a CSV file, try jython/CsvToTurnouts.py
From it¡¯s header: # Read a CSV (comma-separated variable) file containing # # System Name # User Name (optional) # Comment (optional) # # and create a turnout from each line. # Stops when it first encounters a line without # three fields; remove all your blank lines! # Values can be enclosed in quotes (single or double) if desired. Also, the jython/TurnoutStatePersistence.py script does both CSV read and write, but it has a bunch of other stuff in it too. Bob On May 22, 2025, at 12:38?PM, Nick Brownsberger via groups.io <nbrownsbe@...> wrote:¡ª Bob Jacobsen rgj1927@... |
Re: How do I import openpyxl?
Nick and Nick, The following comments are not authoritative.
--------------------- I recommend using the CSV approach. ?Excel can export and import CSV files. ?There are several examples of using CSV files in the jython directory. LogixNG can also use CSV files as a data source. ?However, writing a CSV file is not supported. Dave Sand ----- Original message ----- From: "nicholas murphy via groups.io" <nicholas_murphy=[email protected]> Subject: Re: [jmriusers] How do I import openpyxl? Date: Thursday, May 22, 2025 10:22 AM Hi,? ? This is what Copilot said about running openpyxl in Jython: ? 'Using openpyxl with Jython can be challenging. Openpyxl relies on certain Python features that may not be fully compatible with Jython, which runs on the Java Virtual Machine (JVM). Users have reported issues when trying to install and use openpyxl with Jython 2.7, including import errors and missing dependencies. If you're working with Jython and need to handle Excel files, you might want to explore Apache POI, a Java-based library for working with Excel formats. Alternatively, consider using Python instead of Jython if openpyxl is essential for your project. Would you like help finding an alternative approach?' ? Regards ? Nick ? ? |
Re: Trying to replicate 3-way LogixNG code
#logixng
¿ªÔÆÌåÓýThanks Dave,I still may not be sure what I am doing with LogixNG, though now being up to my ankles, can edit the existing code to fit my purposes. I¡¯ll assume since you didn¡¯t address the existence of a text editor for LogixNG, there isn't any. None the less, you've gotten my interest peaked to continue with more NG code.? John ?Bauchiero -?NCE PH-Pro & PowerCab, Pi4, DCC-EX - JMRI 5.11.6 - Java 17.0.12
|
Re: How do I import openpyxl?
Hi,? ? This is what Copilot said about running openpyxl in Jython: ? 'Using openpyxl with Jython can be challenging. Openpyxl relies on certain Python features that may not be fully compatible with Jython, which runs on the Java Virtual Machine (JVM). Users have reported issues when trying to install and use openpyxl with Jython 2.7, including import errors and missing dependencies. If you're working with Jython and need to handle Excel files, you might want to explore Apache POI, a Java-based library for working with Excel formats. Alternatively, consider using Python instead of Jython if openpyxl is essential for your project. Would you like help finding an alternative approach?' ? Regards ? Nick ? ? |
I think I have JMRI 5 and JAVA 11 loaded on my Win 11 computer
I am trying to get to look at the MACROs from my Clubs Layout, but I thought I needed the internet to my Computer so I got the Clubs computer win11 with Java and Jmri on and I got the some results cannot find USB PORT 3 on both with most of the other options.
?
So this leads me to with or with out the Internet is not really needed, just to check if JMRI and JAVA are working, but mine not connected to the Internet as the Clubs laptop is up the other end of the Club room with Jmri/Java sorting out locos and CVs and other things ok.
?
I have used most of the options with the setup with the both computers, so what else do I need to do to be able to get to the Reading of the Macros.
?
Thanks Graeme
? |
DCC-EX Voltage/current meter
#dcc-ex
I have my windows 10 laptop running JMRI v5.6 with DCC-EX running on an Arduino uno, connected to my laptop via USB, paired with the DCC-EX MotorShield8874.?
When I open the ¡®voltage / current meter¡¯ in Panel Pro, all I get is hyphens - no actual current reading in digits. ?
I¡¯ve had the current meter working before, on an older version of JMRI, running a standard motor shield with the Arduino, but I¡¯ve not tested the current meter since I fitted the new 8874 motor shield.
?
I wanted to check there isn¡¯t anything I¡¯ve missed or failed to configure specifically in JMRI for this before looking into the hardware.
?
Many thanks,
Dan
? |
Re: How do I import openpyxl?
¿ªÔÆÌåÓýNick, I'm not sure it's even possible to include openpyxl. JMRI uses Jython, not Python. Jython is similar to Python but written in Java. It allows Java programs like JMRI to run Python scripts. But since it is written in Java, I don't think it can use Python libraries, unless they are migrated to Jython. Daniel
On 2025-05-22 13:13, Nick Brownsberger
via groups.io wrote:
|
Re: How do I import openpyxl?
Dave,
?
Thanks. I'd like to avoid using a cvs file because I use the spreadsheet to maintain my car fleet as well as in the Jython script.
?
Robert,
?
I tried the path.append statement but it didn't work. My file structure is:
/Applications/JMRI 5.10/openpyxl315/openpyxl.
-
"openpyxl" is just a file. There is no "openpyxl.py" script. Inside the openpyxl file is an "__init__.py" script and other files including /workbook with another "__init__.py" inside.
-
I tried these small scripts:
import os
import sys sys.path.append("/Applications/JMRI 5.10/openpyxl315/openpyxl") - and
import os
import sys sys.path.append("/Applications/JMRI 5.10/openpyxl315/openpyxl/__init__.py") -
I ran them outside of jmri in BBedit and inside jmri using the script menu. But as I said, they didn't work when I ran my script which included the lines:
import os
import sys import time import openpyxl - sys console says "ImportError: No module named openpyxl" -
How should the path.amend statement read, and should I run it from the jmri script menu or from Bbedit or from the Terminal?
?
Thanks again to both of you.
Nick |
Re: VSD dont work
#vsdecoder
Angel,
toggle quoted message
Show quoted text
I recommend to look at an existing and working VSD file, like EMD_645_Turbo.vsd. To the initial part of the config.xml file: The value "diesel" is not a good choice for a profile name. Profile names must be unique. Take "EMD_645" for example. The error remains as long as you do not change the following line in your config.xml file: <sound name="ENGINE" type="SD70"> "SD70" is not valid, use "diesel3" instead. Klaus Am 22.05.2025 um 04:56 schrieb Angel Mora via groups.io: Hello again. I did it, but the result is the same. I still get that prompt. That's the initial part of the code. I wonder if you see anything wrong that you could tell me about? Thank you very much. |
Re: Trying to replicate 3-way LogixNG code
#logixng
John, If you have any LogixNG already created, loading an additional file with LogixNG does not work. I have created an export file which only has the LogixNG with modified system names to prevent conflicts. ?There are no other table entries or panels. ?Load this after loading your regular file. Dave Sand ----- Original message ----- From: "John Bauchiero via groups.io" <john4dhmr=[email protected]> Subject: [jmriusers] Trying to replicate 3-way LogixNG code Date: Wednesday, May 21, 2025 8:14 PM Dave Sand, I saw a copy of your 3way LogixNG.xml code (May 6th) which looked interesting (anyway, I assume it¡¯s yours). It operates much smoother than the Sensor/Route/Turnout conglomeration I developed to do the same thing. Up until now, I have been avoiding any Logix or LogixNG coding, at my age, I really didn¡¯t want to learn another programming language.? Since the code operated the 3-way turnouts just the way I liked. My plan was to add it to my layout.xml with a modification adding of two extra tracks/turnouts. I tried merging the two xml files (but it created two separate panels), not ideal. I also tried the proper way, creating the code from scratch, but (for me) LogixNG is a steep learning curve. I don¡¯t understand the methodology of how to program by completing the dialog boxes. I got as far as the lines completing the (if-) then-else statements which I couldn¡¯t get it to look like your code, I became so frustrated, the project got put on the back burner.? Is there an editor to directly type-in the code, leaving the debugger to point out syntax errors? I would like an easier way to replicate your code. Thank you in advance for your expertise.? ? John ?Bauchiero -?NCE PH-Pro & PowerCab, Pi4, DCC-EX - JMRI 5.11.6 - Java 17.0.12 |
Re: VSD dont work
#vsdecoder
Hello again. I did it, but the result is the same. I still get that prompt. That's the initial part of the code. I wonder if you see anything wrong that you could tell me about? Thank you very much.
?
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/xml/XSLT/vsdecoder-config.xsl"?>? <vsdecoder-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://jmri.org/xml/schema/vsdecoder/vsdecoder-config.xsd"> ? <!-- SD70ACE Prime Mover -->
? <!-- Used on many EMD Diesels 1975-present --> ? <!-- Examples: ? * SD70, SD70M, SD70ACE, SD70MAC (16-cylinder) --> ? <profile name="diesel">
? ? <!-- generic bell borrowed from the sd70ace -->
? ? <sound-event name="BELL" label="Bell-EMD 8475495 Steel Bell 049 End.wav" buttontype="TOGGLE"> ? ? ? <trigger name="BELL_BUTTON_STOP" type="BUTTON"> ? ? <event-name>BUTTON</event-name> ? ? <target-name>BELL</target-name> ? ? <match>false</match> ? ? <action>STOP</action> ? ? ? </trigger> |
Re: Edit dialog boxes do not open with full width
Ken,
?
Attached are a couple of traces. They are really traces of the same activity but I noticed something interesting. Process was:
?
You'll notice in the log that I put a blank line between steps 5 and 6 and also between steps 7 and 8 just for clarity.
?
I looked over the log and noticed references to screens 3 and 5. That reminded me that I'm running three desktops on the system. So, effectively, 6 monitors, so 3 and 5 would make sense. Seemed promising....maybe the OS is fetching screen sizes for screens that are not displayed and therefore zero? The trace named "JMRI_Trace_3_Desktops.txt" was captured running in this configuration.
?
To test the question of whether 3 desktops were the problem, I deleted desktops 2 and 3 and reran JMRI. Oddly, the log still showed references to screens 3 and 5. So, I rebooted the system and tried again. This time the log showed references to screen 1 and 2. You can see that in the other trace ("JMRI_Trace_1_Desktop.txt").
?
That's it for now. BTW, I also run desktops on the older system and did not have any problems.
?
Vince JMRI_Trace_3_Desktops.txt
JMRI_Trace_3_Desktops.txt
JMRI_Trace_1_Desktop.txt
JMRI_Trace_1_Desktop.txt
|
Re: Looking for ideas to mirror SE8C signals between two panels
On 5/21/2025 8:40 PM, cengel_74 via groups.io wrote:
So the question is, is there a way to resolve this issue or do I just need to manually load the script after the panel until we get to the point of loading the panel in the startupYes, you will just need to manually load the script. |
Trying to replicate 3-way LogixNG code
#logixng
¿ªÔÆÌåÓýDave Sand, I saw a copy of your 3way LogixNG.xml code (May 6th) which looked interesting (anyway, I assume it¡¯s yours). It operates much smoother than the Sensor/Route/Turnout conglomeration I developed to do the same thing. Up until now, I have been avoiding any Logix or LogixNG coding, at my age, I really didn¡¯t want to learn another programming language.? Since the code operated the 3-way turnouts just the way I liked. My plan was to add it to my layout.xml with a modification adding of two extra tracks/turnouts. I tried merging the two xml files (but it created two separate panels), not ideal. I also tried the proper way, creating the code from scratch, but (for me) LogixNG is a steep learning curve. I don¡¯t understand the methodology of how to program by completing the dialog boxes. I got as far as the lines completing the (if-) then-else statements which I couldn¡¯t get it to look like your code, I became so frustrated, the project got put on the back burner.? Is there an editor to directly type-in the code, leaving the debugger to point out syntax errors? I would like an easier way to replicate your code. Thank you in advance for your expertise.? ? John ?Bauchiero -?NCE PH-Pro & PowerCab, Pi4, DCC-EX - JMRI 5.11.6 - Java 17.0.12 |
Re: Looking for ideas to mirror SE8C signals between two panels
This script worked in my?manual testing so now I need to test it on the real layout. However I'm pretty sure I know the answer to this stupid question but I'm going to ask it anyway.? We typically load up PanelPro and then manually load the panel that we are going to load since we are actively working on it and have many versions, backups etc.? It appears that if I put this script into the startup it causes issues which I suppose makes sense because the signal heads haven't been defined yet : 19:33:14,574 ptionhandler.UncaughtExceptionHandler ERROR - Uncaught Exception caught by jmri.util.exceptionhandler.UncaughtExceptionHandler [AWT-EventQueue-0] org.python.core.PyException: AttributeError: 'NoneType' object has no attribute 'setAppearance' at org.python.core.Py.AttributeError(Py.java:176) ~[jython-standalone-2.7.4.jar:2.7.4] at org.python.core.PyObject.noAttributeError(PyObject.java:965) ~[jython-standalone-2.7.4.jar:2.7.4] at org.python.core.PyObject.__getattr__(PyObject.java:959) ~[jython-standalone-2.7.4.jar:2.7.4] at org.python.pycode._pyx0.propertyChange$3(<script>:42) ~[?:?] at org.python.pycode._pyx0.call_function(<script>) ~[?:?] So the question is, is there a way to resolve this issue or do I just need to manually load the script after the panel until we get to the point of loading the panel in the startup? On Mon, May 19, 2025 at 10:10?AM cengel_74 via <chrisengel=[email protected]> wrote:
--
?Chris |
Re: Edit dialog boxes do not open with full width
¿ªÔÆÌåÓýVince, ? Here is a clue. jmri.util.JmriJFrame ? If you set that to TRACE level, it will show more of how it is figuring out size stuff. Might not get you an answer but worth a shot. ? Debug->Display/Edit Log Categories At the bottom scroll box, go down the list to: jmri.util.JmriJFrame then pick TRACE in the ¡®New level for above category¡¯ pull down. ? I¡¯m suspecting that something is saying the screen is way smaller and that confuses everything. ? -Ken Cameron, Member JMRI Dev Team
? ? |