From: Mico S. <mic...@ya...> - 2009-07-27 14:54:39
|
Hi, I tried to follow steps of distributing Jython script mentioning in: http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. But none worked. What I did: 1. Copy standalone jython.jar to my working directory, renamed it to toba.jar 2. Rename my main script to __run__.py and add it to toba.jar file using jar: jar uvf toba.jar __run__.py 3. From command prompt: java -cp toba.jar org.python.util.jython -jar toba.jar Then nothing happened. After few seconds it return back to prompt. Did I miss something? regards, Mico |
From: David H. <Dav...@sa...> - 2009-07-27 15:16:31
|
Here is a hint to solve your __run__.py problem. Here is my __run__.py that I tried: if __name__ == '__main__': print "Hello from __run__.py" else: print "__main__ not defined when __run__.py is executed" Here is the output when I ran it the same way you ran yours: __main__ not defined when __run__.py is executed Does this give you a clue? David H > -----Original Message----- > From: Mico Siahaan [mailto:mic...@ya...] > Sent: Monday, July 27, 2009 10:54 AM > To: jyt...@li... > Subject: [Jython-users] Distributing Jython Scripts > > > Hi, I tried to follow steps of distributing Jython script mentioning in: > http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. But > none worked. What I did: > 1. Copy standalone jython.jar to my working directory, renamed it to > toba.jar > 2. Rename my main script to __run__.py and add it to toba.jar file > using jar: jar uvf toba.jar __run__.py > 3. From command prompt: java -cp toba.jar org.python.util.jython -jar > toba.jar > > Then nothing happened. After few seconds it return back to prompt. > Did I miss something? > > regards, > > Mico > > > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users |
From: David H. <Dav...@sa...> - 2009-07-27 15:24:09
|
By the way, if it is not considered a bug that Jython does not set __name__ to '__main__' like it does for regular start scripts, then at least that behavior should be documented on the wiki page he was following. I have this feeling of Déjà vu like we've had this question before on the jython list... David H > -----Original Message----- > From: David Handy > Sent: Monday, July 27, 2009 11:16 AM > To: 'mic...@ya...'; jyt...@li... > Subject: RE: [Jython-users] Distributing Jython Scripts > > Here is a hint to solve your __run__.py problem. Here is my __run__.py > that I tried: > > if __name__ == '__main__': > print "Hello from __run__.py" > else: > print "__main__ not defined when __run__.py is executed" > > Here is the output when I ran it the same way you ran yours: > > __main__ not defined when __run__.py is executed > > Does this give you a clue? > > David H > > > > > -----Original Message----- > > From: Mico Siahaan [mailto:mic...@ya...] > > Sent: Monday, July 27, 2009 10:54 AM > > To: jyt...@li... > > Subject: [Jython-users] Distributing Jython Scripts > > > > > > Hi, I tried to follow steps of distributing Jython script mentioning > in: > > http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. > But > > none worked. What I did: > > 1. Copy standalone jython.jar to my working directory, renamed it to > > toba.jar > > 2. Rename my main script to __run__.py and add it to toba.jar file > > using jar: jar uvf toba.jar __run__.py > > 3. From command prompt: java -cp toba.jar org.python.util.jython -jar > > toba.jar > > > > Then nothing happened. After few seconds it return back to prompt. > > Did I miss something? > > > > regards, > > > > Mico > > > > > > > > > > --------------------------------------------------------------------- > -- > > ------- > > _______________________________________________ > > Jython-users mailing list > > Jyt...@li... > > https://lists.sourceforge.net/lists/listinfo/jython-users |
From: Leo S. M. <leo...@gm...> - 2009-07-28 04:26:19
|
On Mon, Jul 27, 2009 at 11:23 AM, David Handy<Dav...@sa...> wrote: > By the way, if it is not considered a bug that Jython does not set > __name__ to '__main__' [...] Please fill a bug about the __name__ not being set to '__main__' in this case, so it is not forgotten (and so it can be fixed in the upcoming 2.5.1 release) -- Leo Soto M. http://blog.leosoto.com |
From: David H. <Dav...@sa...> - 2009-07-31 19:20:07
|
> -----Original Message----- > From: Leo Soto M. [mailto:leo...@gm...] > On Mon, Jul 27, 2009 at 11:23 AM, David Handy<Dav...@sa...> > wrote: > > By the way, if it is not considered a bug that Jython does not set > > __name__ to '__main__' [...] > > Please fill a bug about the __name__ not being set to '__main__' in > this case, so it is not forgotten (and so it can be fixed in the > upcoming 2.5.1 release) Done. http://bugs.jython.org/issue1418 David H |
From: Leo S. M. <leo...@gm...> - 2009-08-06 20:25:29
|
On Fri, Jul 31, 2009 at 3:19 PM, David Handy<Dav...@sa...> wrote: >> -----Original Message----- >> From: Leo Soto M. [mailto:leo...@gm...] >> On Mon, Jul 27, 2009 at 11:23 AM, David Handy<Dav...@sa...> >> wrote: >> > By the way, if it is not considered a bug that Jython does not set >> > __name__ to '__main__' [...] >> >> Please fill a bug about the __name__ not being set to '__main__' in >> this case, so it is not forgotten (and so it can be fixed in the >> upcoming 2.5.1 release) > > Done. > > http://bugs.jython.org/issue1418 I'm sorry, but I ended up closing the bug as won't fix. In principle I agree that Jython shold set __name__ to '__main__' in this case, but looking at the code shows that the current behavior was a conscious decision made in the past (I thought it could be an accident) so changing it could break old code. At least I modified the Distributing Jython Scripts wiki page to avoid these problems in the future -- but feel free to revise and improve it further if needed. After all it's our community wiki! :) -- Leo Soto M. http://blog.leosoto.com |