How to convert a Python program to Genie?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
justterry
Posts: 2
Joined: Mon 02 Aug 2010, 18:24

How to convert a Python program to Genie?

#1 Post by justterry »

I have been searching for a way to create simple utilities for a while now and was quite happy when I found the Vala website. But I am a sometime Perl scripter, and refugee from the old-school mainframe coding era - now a full-time technical documentation and software support person. I'm rusty enough to know it's going to take a while to learn this. And that's okay, mostly but recently I was tasked by my manager to take over support of a Python utility that is used to create configuration files for an internal specialized database tool.

While the script is pretty straightforward (it uses easygui to gather parameters, parses a config file and writes out another, XML-formatted config file), our internal installs of Python are not and I thought it would be pretty cool to translate it to Genie. But I'm struggling to learn from the bits of code posted here and there on my own time so I need to either get out my Python book and learn to do that freeze thing or ask for help. (I had started to take apart the Picture Viewer -cool program, btw- but got bogged down pretty fast.)

While this isn't a homework request per se, I do realize that it is not cool to ask someone to do real work for me. I'm not in the position to pay someone to do this but I thought that perhaps someone might take it on if I made a donation to Puppy via Barry Kauler's donate button. So, I donated $25 to start with. I will make an equal donation to Puppy or another open source project if we can get close to my script with a Windows-compiled Genie program. I hope this request doesn't offend... this kind of program could be useful to many people, since it reads, parses and writes out a file and could easily be adapted for a variety of uses.

I work in a MS Windows environment but I like Puppy a lot and use it often at home. My granddaughter loves the Barbie version I downloaded for her a couple of years ago. Now that I know there is a way to do small, cross-platform tools I'm looking forward to learning more about the Puppy/Genie platform.

Thanks,

Terry

p.s. the attached file includes the python script, the config file and a copy of easygui so someone can run it. I only included one out of four possible file types, so only run the paf choice.
Attachments
sample.jpg
screen print of the easygui.py input screen
(24.03 KiB) Downloaded 906 times
genie2.zip
file with python script, sample input and output file
(59.88 KiB) Downloaded 396 times

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#2 Post by technosaurus »

Not much help with windows here, but xml should be fairly portable - maybe someone else knows if anything is more portable than gtk (fltk/qt don't have vala bindings AFAIK)

Have you had a look at these vala example:
http://live.gnome.org/Vala/XmlSample
http://code.valaide.org/search/node/xml

anyhow - it doesn't seem so intense that python couldn't handle it on windows
Could probably speed it up quite a bit by combining the fileout.write calls into one per function. (xml ignores all of that free space and there are plenty of auto-formating tools)

I just posted on a thread here a couple days ago for doing something similar using basic utils that are in busybox (sed, grep, cut, echo...)
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

justterry
Posts: 2
Joined: Mon 02 Aug 2010, 18:24

#3 Post by justterry »

technosaurus wrote:Not much help with windows here, but xml should be fairly portable - maybe someone else knows if anything is more portable than gtk (fltk/qt don't have vala bindings AFAIK)

Have you had a look at these vala example:
http://live.gnome.org/Vala/XmlSample
http://code.valaide.org/search/node/xml

anyhow - it doesn't seem so intense that python couldn't handle it on windows
Could probably speed it up quite a bit by combining the fileout.write calls into one per function. (xml ignores all of that free space and there are plenty of auto-formating tools)

I just posted on a thread here a couple days ago for doing something similar using basic utils that are in busybox (sed, grep, cut, echo...)
Thank you for replying but I think I may have not been very clear in what I need. The script is working, more or less, in Python but I want something compiled so that users don't have to worry about Python versions (easygui needs 2.6, I think) - or even Python installed at all. All the users will be in the Windows environment, so busybox is not an option. I know this is a Linux forum but I've seen many references to Windows and the best thing about Vala/Genie is that it's cross-platform.

Although the output file is XML format, I don't need to worry about that because I have the text chunks already to write to a file once the variables are substituted. It's wrapping my head around the file interaction dialogs and figuring out how to parse the data I need from the input file that is hard with a new language. I had considered Autoit or Autohotkey but again, Vala is the better choice in the long run.

I actually found a program that is very similar to what I need inside Vala Toys for Gedit:

http://code.google.com/p/vtg/

It's called ValaGenProject and I've been struggling to get it compiled with Vala so that I can then play around with it. Not only am I not having much luck, it's Vala and Genie is just so much easier to follow.

FTR, I have successfully compiled several small samples from the Vala website in Windows but this is more involved. Maybe when I get the time I'll download a Puppy that is setup for compiling Vala.

It would be nice to see a comparison of file commands - Python/Genie. That might make it easier to translate something like this.

Thanks again,

Terry

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#4 Post by neurino »

py2exe but do not expect small size programs if you are using GUIs (wxPython for example)

User avatar
paulhomebus
Posts: 120
Joined: Thu 21 Jan 2010, 23:23
Location: New Zealand
Contact:

#5 Post by paulhomebus »

I recently had success compiling something into an exe with cxfreeze...
It packaged up the wxPython/wxwidget based program quite well.

Tho I had to do my compiling in Ubuntu -- but it worked in Lupu 5.1...

Dpg4x is the result here....
http://www.murga-linux.com/puppy/viewto ... 714#443714

Paul

User avatar
Iguleder
Posts: 2026
Joined: Tue 11 Aug 2009, 09:36
Location: Israel, somewhere in the beautiful desert
Contact:

#6 Post by Iguleder »

I remember I compiled something with something2exe if I remember right, but the executable was rather big, about 2.5 MB.

There is no way to write something that runs on any operating system and any platform except scripts (Python/Perl/...).

I just gave up on that, I write stuff in Perl or Python when I work with databases or complex stuff (like Pdebthing :)). I don't care about Windows users ... all other systems have Perl.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#7 Post by neurino »

Iguleder wrote:I remember I compiled something with something2exe if I remember right, but the executable was rather big, about 2.5 MB.
neurino wrote:py2exe but do not expect small size programs if you are using GUIs (wxPython for example)
:roll:

Post Reply