Keyboard Shortcuts
Likes
- Jmriusers
- Messages
Search
Re: How do I import openpyxl?
¿ªÔÆÌåÓýYou can manage Excel files as .csv as well as .xls - just choose the format when you save the filePhil G On 22 May 2025, at 21:43, Nick Brownsberger via groups.io <nbrownsbe@...> wrote:
|
Re: How do I import openpyxl?
On May 22, 2025, at 4:43?PM, Nick Brownsberger via groups.io <nbrownsbe@...> wrote:Could you say a bit more about what problems you¡¯re thinking of for the CSV file? Excel is quite happy writing and reading CSV files from its standard spreadsheets. Bob ¡ª Bob Jacobsen rgj1927@... |
Re: How do I import openpyxl?
Dave,
?
To answer your question, I have an Excel spreadsheet listing about 600 cars with various information about them like type, road, number, etc. I'm using a barcode reader to identify a car ID as it rolls over a hump and send it to a Jython program. The program gets some car related information out of the spreadsheet such as car length and destination. Then it looks up the train and classification track assigned for that destination and throws turnouts to send the car to the right track.
?
Right now, using openpyxl, the program works outside of jmri to get the track I need, but it can't throw turnouts without being inside jmri.
?
It doesn't sound like openpyxl is compatible with jmri and Apache POI is way over my head.
?
I'm looking at using csv files, but manipulating a 600 record csv file sounds daunting. Or, I could instantiate a class of 600 cars in the Jython program which I was trying to avoid. I'm also rethinking my strategy as well.
?
Thanks to all,
Nick
? |
Re: DCC-EX Voltage/current meter
#dcc-ex
There are two reasons why the current meter is not reporting.
a.? JMRI current meter uses the <c> command to obtain the information from the DCC-EX command station.? With limited memory, the <c> command is no longer available when Uno (or Nano) is the DCC-EX command station.? This change would be seen in version 5.2.25 and later versions.?? b.? JMRI does not enable current reporting by default.? When you open current meter, use the menu to enable it.? But when used with Uno, you will see the message 'None available'.?
Note that the <c> command is now obsolete, as it only reports for Track A.
There is a new command <JI>? (upper case j i) and it is available for use with Uno. The DCC-EX discord server is good to discuss issues, including those related to JMRI when using DCC-EX. ?
Regards, Ash__ |
Re: LogixNG POM
#logixng
¿ªÔÆÌåÓýVinny, > Now I'd like to ADD an IM value to the CV. What error message do you get? Daniel
On 2025-05-21 22:39, Vinny DeRobertis
via groups.io wrote:
|
Re: I think I have JMRI 5 and JAVA 11 loaded on my Win 11 computer
Depending on the computer and what is now or may ever have been plugged into it, the correct COM port may or may not be COM3.
?
To check which COM port you need to assign into JMRI, open Device Manager, expand the "Ports" branch, and plug/unplug your interface device. The correct COM port will appear/disappear as you do this (may take several seconds to do so).
?
HTH,
Steve
"Breezlys" |
Re: Trying to replicate 3-way LogixNG code
#logixng
John, There is no "text editor". ?You can get a text view of a LogixNG using the Browse option in the Select menu. ?However, that does not show all of the details. Prior to LogixNG, I would use scripts to handle special cases. ?Many of those have been converted to LogixNG. Dave Sand ----- Original message ----- From: "John Bauchiero via groups.io" <john4dhmr=[email protected]> Subject: Re: [jmriusers] Trying to replicate 3-way LogixNG code Date: Thursday, May 22, 2025 10:40 AM 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: 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. |