[Tutor] python "glue"
Hi I recently bought a book (python programing for the absolute beginner) and it said python was a "glue" language (could work with other languages) I've been trying to make apps for android and webOS and I was wondering if I could use python for doing this through "glueing" to program games on android and webOS can anyone help? yours sincerely minipot p.s:I have already tried pygame subset for android but it didn't give me enough freedom. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] python "glue"
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/05/2011 06:25 AM, Benjamin Gregg wrote: > Hi I recently bought a book (python programing for the absolute beginner) > and it said python was a "glue" language (could work with other languages) > I've been trying to make apps for android and webOS and I was wondering > if I could use python for doing this through "glueing" to program games > on android and webOS can anyone help? If you're on the android your options are limited. Indeed Python can work with other languages, but not all of them and not easily. The standard Python implementation, CPython, can really only glue together C or C++ stuff. Jython can do Java, and IronPython can work with anything that is using the .NET CLI. On the 'droid your best bet would probably be http://code.google.com/p/android-scripting/, but it's still very *very* limited. For webOS it looks like the only way you'll get Python is if you whip together a C(++) program that statically links to it. - -- Corey Richardson -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (GNU/Linux) iQEcBAEBAgAGBQJN67V8AAoJEAFAbo/KNFvpv/MH/088lDJQqNlOHk/vKrzTjafQ Mn0ybNrk3sKozkL5GE/UdX+ESTxmAnYUnDBM2VFNEV/FjBxyDTLfLAGEzBNs2u4t LHvClprfW00xexm6wcOLMQHmR+peaPC5MGRIZgesP63istqkSNryxFAAlzRG9WW8 mJS8+r9BkQiSSDSdXDv2Jlk3/pNIwvMpp9Pwob9+O7IW4emSfqi1MtsTlkG9TnEv HI3YQuDCSVQWyWZpUup7wSqlyUMr3LY5TiOXal4SFNLIh8Tw30p9uSB7s10VBntv SURLH0pqTM7qWb7VKLCTRNwM5cda2pooXo/CPs/CdrG4mbWvyOiqpisihYrZQ5g= =plrm -END PGP SIGNATURE- ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] python "glue"
I think by "glue language", it meant that it's also a "lightweight" programming language in a sense that it can be used for scripting. Just slap pieces of code and external programs together and make it all work in harmony. When I hear "gluing", I think you did not write everything from scratch but you basically took existing programs you use everyday and automated daily tasks by "gluing" these programs together, where the glue would be a thin layer of Python. I could think of gluing if, for example, you wrote a Python program to read commands from user input, connect to multiple servers by calling the "ssh" program, issue commands to all server simultaneously, parse outputs, log them to a file, detect / reformat errors to be shown back to the end-user and upload log files to a backup server using the "ftp" program. Sorry, this doesn't answer your WebOS / Android games questions. I am not familiar with those so I can't tell. I just wanted to give my version of the "glue language" wording. 2011/6/5 Benjamin Gregg : > Hi I recently bought a book (python programing for the absolute beginner) > and it said python was a "glue" language (could work with other languages) > I've been trying to make apps for android and webOS and I was wondering > if I could use python for doing this through "glueing" to program games on > android and > webOS can anyone help? > > yours sincerely minipot > > p.s:I have already tried pygame subset for android but it didn't give me > enough freedom. > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Alex | twitter.com/alexconrad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] No module named player_data
why does this happen? server [folder] player_data [folder] server.py Traceback (most recent call last): File "C:\Users\MySelf\Program\game_stuff\Game_28_02_11\Servers\server_client_begining\server.py", line 3, in from player_data import PlayerArmy ImportError: No module named player_data from player_data import PlayerArmy from player_data import PlayerBaseData from player_data import PlayerEnabledFlags from player_data import PlayerResearch from player_data import PlayerResearchers from player_data import PlayerTotalWeapons from player_data import PlayerWeaponsEquipped from player_data import PlayerWeaponsUnequipped this worked before i tried: from player_data import * """from player_data import PlayerArmy from player_data import PlayerBaseData from player_data import PlayerEnabledFlags from player_data import PlayerResearch from player_data import PlayerResearchers from player_data import PlayerTotalWeapons from player_data import PlayerWeaponsEquipped from player_data import PlayerWeaponsUnequipped""" got error about PlayerBaseData not found then undid back to: from player_data import PlayerArmy from player_data import PlayerBaseData from player_data import PlayerEnabledFlags from player_data import PlayerResearch from player_data import PlayerResearchers from player_data import PlayerTotalWeapons from player_data import PlayerWeaponsEquipped from player_data import PlayerWeaponsUnequipped now it does not work why using python 3 and tried with python 2.7 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] No module named player_data
2011/6/5 Michael bridges : > why does this happen? > > server [folder] > player_data [folder] > server.py > > Traceback (most recent call last): > File > "C:\Users\MySelf\Program\game_stuff\Game_28_02_11\Servers\server_client_begining\server.py", > line 3, in > from player_data import PlayerArmy > ImportError: No module named player_data If player_data is a package (a folder containing an __init__.py file), I guess you have your class PlayerArmy defined inside the __init__.py file, or you are importing PlayerArmy from __init__.py. Could you provide more details on what the "player_data" folder contains? -- Alex | twitter.com/alexconrad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] No module named player_data
one of the things i deleted was __init__.py & __init__.pyc [thought it was not used, then read import again and put it back. still not working] player_data [folder] __init__.py [several .py & .pyc files] --- On Sun, 6/5/11, Alexandre Conrad wrote: > From: Alexandre Conrad > Subject: Re: [Tutor] No module named player_data > To: "Michael bridges" > Cc: Tutor@python.org > Date: Sunday, June 5, 2011, 7:11 PM > 2011/6/5 Michael bridges : > > why does this happen? > > > > server [folder] > > player_data [folder] > > server.py > > > > Traceback (most recent call last): > > File > "C:\Users\MySelf\Program\game_stuff\Game_28_02_11\Servers\server_client_begining\server.py", > line 3, in > > from player_data import PlayerArmy > > ImportError: No module named player_data > > If player_data is a package (a folder containing an > __init__.py file), > I guess you have your class PlayerArmy defined inside the > __init__.py > file, or you are importing PlayerArmy from __init__.py. > > Could you provide more details on what the "player_data" > folder contains? > > -- > Alex | twitter.com/alexconrad > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] No module named player_data
2011/6/5 Michael bridges : > one of the things i deleted was __init__.py & __init__.pyc [thought it was > not used, then read import again and put it back. still not working] You always need an __init__.py file in a folder that you want to import in Python. That tells Python to consider the folder as a Pyton package. http://effbot.org/pyfaq/what-is-init-py-used-for.htm Your original error was: "ImportError: No module named player_data". Now you have the file back, I now suspect the error message might be slightly different. Could you copy/paste it please? -- Alex | twitter.com/alexconrad ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] No module named player_data
more specific general info [do not want to copy/paste the whole files]: [\server_client_begining\server.py] from player_data import PlayerArmy [\server_client_begining\player_data\PlayerArmy] #PlayerArmy playerName = "john" militia_amount = 100 military_amount = 10 [with more variables] [no classes, no functions, just variables] --- On Sun, 6/5/11, Alexandre Conrad wrote: > From: Alexandre Conrad > Subject: Re: [Tutor] No module named player_data > To: "Michael bridges" > Cc: Tutor@python.org > Date: Sunday, June 5, 2011, 7:11 PM > 2011/6/5 Michael bridges : > > why does this happen? > > > > server [folder] > > player_data [folder] > > server.py > > > > Traceback (most recent call last): > > File > "C:\Users\MySelf\Program\game_stuff\Game_28_02_11\Servers\server_client_begining\server.py", > line 3, in > > from player_data import PlayerArmy > > ImportError: No module named player_data > > If player_data is a package (a folder containing an > __init__.py file), > I guess you have your class PlayerArmy defined inside the > __init__.py > file, or you are importing PlayerArmy from __init__.py. > > Could you provide more details on what the "player_data" > folder contains? > > -- > Alex | twitter.com/alexconrad > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] No module named player_data
Traceback (most recent call last): File "C:\Users\MySelf\Program\game_stuff\Game_28_02_11\Servers\server_client_begining\server.py", line 3, in from player_data import PlayerArmy ImportError: No module named player_data --- On Sun, 6/5/11, Alexandre Conrad wrote: > From: Alexandre Conrad > Subject: Re: [Tutor] No module named player_data > To: "Michael bridges" > Cc: Tutor@python.org > Date: Sunday, June 5, 2011, 7:58 PM > 2011/6/5 Michael bridges : > > one of the things i deleted was __init__.py & > __init__.pyc [thought it was not used, then read import > again and put it back. still not working] > > You always need an __init__.py file in a folder that you > want to > import in Python. That tells Python to consider the folder > as a Pyton > package. > > http://effbot.org/pyfaq/what-is-init-py-used-for.htm > > Your original error was: "ImportError: No module named > player_data". > Now you have the file back, I now suspect the error message > might be > slightly different. Could you copy/paste it please? > > > -- > Alex | twitter.com/alexconrad > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] No module named player_data
simple file was named __ init __.py not __init__.py restored from recycle bin showed the error thanks for your help --- On Sun, 6/5/11, Alexandre Conrad wrote: > From: Alexandre Conrad > Subject: Re: [Tutor] No module named player_data > To: "Michael bridges" > Cc: Tutor@python.org > Date: Sunday, June 5, 2011, 7:58 PM > 2011/6/5 Michael bridges : > > one of the things i deleted was __init__.py & > __init__.pyc [thought it was not used, then read import > again and put it back. still not working] > > You always need an __init__.py file in a folder that you > want to > import in Python. That tells Python to consider the folder > as a Pyton > package. > > http://effbot.org/pyfaq/what-is-init-py-used-for.htm > > Your original error was: "ImportError: No module named > player_data". > Now you have the file back, I now suspect the error message > might be > slightly different. Could you copy/paste it please? > > > -- > Alex | twitter.com/alexconrad > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] about print()
Hi all, I am a newbie of python, and reading 'python essential reference'. Now I want to print this results 'a is %d' % a -> a is 42 > with the code a = 42 > test = "'a is %d' % a" > print( '%20s ->' % test, test) > but what I get is > 'a is %d' % a -> 'a is %d' % a > What is the difference of print(test) and print ( 'a is %d' % a )? Regards ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor