Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 31 Oct 2014, 00:58
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to convert a Python program to Genie?
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
justterry

Joined: 02 Aug 2010
Posts: 2

PostPosted: Mon 02 Aug 2010, 15:55    Post_subject:  How to convert a Python program to Genie?  

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.
sample.jpg
 Description   screen print of the easygui.py input screen
 Filesize   24.03 KB
 Viewed   801 Time(s)

sample.jpg

genie2.zip
Description  file with python script, sample input and output file
zip

 Download 
Filename  genie2.zip 
Filesize  59.88 KB 
Downloaded  239 Time(s) 
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Mon 02 Aug 2010, 23:25    Post_subject:  

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...)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
justterry

Joined: 02 Aug 2010
Posts: 2

PostPosted: Tue 03 Aug 2010, 00:20    Post_subject:  

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
Back to top
View user's profile Send_private_message 
neurino


Joined: 15 Oct 2009
Posts: 360

PostPosted: Mon 23 Aug 2010, 07:29    Post_subject:  

py2exe but do not expect small size programs if you are using GUIs (wxPython for example)
Back to top
View user's profile Send_private_message 
paulhomebus


Joined: 21 Jan 2010
Posts: 120
Location: New Zealand

PostPosted: Mon 23 Aug 2010, 08:13    Post_subject:  

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/viewtopic.php?p=443714#443714

Paul
Back to top
View user's profile Send_private_message Visit_website AIM 
Iguleder


Joined: 11 Aug 2009
Posts: 1923
Location: Israel, somewhere in the beautiful desert

PostPosted: Mon 23 Aug 2010, 08:30    Post_subject:  

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 Smile). I don't care about Windows users ... all other systems have Perl.

_________________
My homepage
Back to top
View user's profile Send_private_message Visit_website MSNM 
ICQ 
neurino


Joined: 15 Oct 2009
Posts: 360

PostPosted: Mon 23 Aug 2010, 08:56    Post_subject:  

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)


Rolling Eyes
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0672s ][ Queries: 12 (0.0044s) ][ GZIP on ]