Re: [Tutor] Working with Data files & Lists

2014-06-02 Thread Danny Yoo
On Mon, Jun 2, 2014 at 8:34 AM, JEAN MICHEL wrote: > I'm a Python beginner trying write a program that reads outside txt files, > takes the data like the name and test grades of students then calculate the > average and also assigns a grade and writes the data into a new txt file. > I'm having dif

Re: [Tutor] Swampy: No module name World , (Steven D'Aprano)(Dave Angel)(Alan Gauld)

2014-06-02 Thread Charles Agriesti
Thank you very much for the kind replies. apologies for the html being on. Apparently Thunderbird turns it back on when it updates. Should be off now. swampy does contain __init__.py it is completely blank sampy also contains __init__.pyc that does contain a couple of lines ending with: C:\

[Tutor] Working with Data files & Lists

2014-06-02 Thread JEAN MICHEL
I'm a Python beginner trying write a program that reads outside txt files, takes the data like the name and test grades of students then calculate the average and also assigns a grade and writes the data into a new txt file. I'm having difficulties writing the program so far I've been able to write

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Mark Lawrence
On 02/06/2014 17:08, Sydney Shall wrote: Would you please be kind enough to stop top posting, it makes following a thread difficult, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence --- This email is free from v

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
Thanks Steven I will try what you recommend. You were correct. Not understanding properly, I had constucted both a directory and a file in my module directory. I can now correct it, I think. Thanks for all your help Sydney On 02/06/2014 17:47, Steven D'Aprano wrote: On Mon, Jun 02, 2014 at 05:0

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Steven D'Aprano
On Mon, Jun 02, 2014 at 05:08:21PM +0100, Sydney Shall wrote: > Thanks for the detailed reply, Steven. > It seems that you have correctly identified my prblem. > > But I am still puzzled, because I do not know how this happened. > I simply copied the two files that I wished to import to a director

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
Thanks for the detailed reply, Steven. It seems that you have correctly identified my prblem. But I am still puzzled, because I do not know how this happened. I simply copied the two files that I wished to import to a directory called (nowMyModule). It now contains only three files; > pwd Out[9

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Steven D'Aprano
On Mon, Jun 02, 2014 at 03:41:15PM +0100, Sydney Shall wrote: > Alan, > Please forgive me, but I am still unclear. > Do you mean that I must add a file called __ini__.py to my folder or do > you mean that each file that I wish to import should have that statement > [ __init__.py ] immediately aft

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Steven D'Aprano
On Mon, Jun 02, 2014 at 01:21:29PM +0100, Sydney Shall wrote: > I am having a similar problem. Actually, I don't think so. Your problem doesn't appear to have anything to do with the problem that Charles Agriesti is having. The only connection seems to be that you are both using Python. Read on

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
Alan, Please forgive me, but I am still unclear. Do you mean that I must add a file called __ini__.py to my folder or do you mean that each file that I wish to import should have that statement [ __init__.py ] immediately after (I presume) my def statement? If it must be a file, what is in this

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Emile van Sebille
On 6/2/2014 5:21 AM, Sydney Shall wrote: I am having a similar problem. However, when I use the import statement in my program I get a runtime error as follows: in () > 1 CapitalSimulation(51, 4000.0, 20.0, 20.0, 100, 1.0, 0.0, 40.0, 1.0) /Users/sydney/My_Documents/Political_Economy/C

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Alan Gauld
On 02/06/14 13:21, Sydney Shall wrote: I do not really understand what Steven is recommending below. Is it an init statement in a file or is it an independent file. It is an independent file (which can be empty) whose existence indicates to python that a folder is a package. Thus if you have

Re: [Tutor] Swampy: No module name World

2014-06-02 Thread Mark Lawrence
On 02/06/2014 02:33, Charles Agriesti wrote: from swampy.World import World world = World() ImportError: No module name World These scripts run with no problem as long as the file location is the python27 folder. But not from outside the folder. Other modules, like math, import with no problem

[Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
I am having a similar problem. I have now worked out how to copy my helper file to the correct location, in my case is: '/Users/sydney/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages' When I type the following at the IPython prompt I get no error message; import findGraphParamet

Re: [Tutor] gnupg within a for loop

2014-06-02 Thread Adam Gold
On 02/06/14 01:35, Danny Yoo wrote: >> Thanks Danny, that was spot on. I actually used os.chdir to change to >> the base directory (which I assigned to a variable) just before the open >> statement. I don't know if that's 'pythonically' correct but it seemed >> like a simple way to do it. Again,

Re: [Tutor] gnupg within a for loop

2014-06-02 Thread Adam Gold
On 01/06/14 18:28, Danny Yoo wrote: > Hi Adam, > > Ah; I've seen this before. Make sure the file name is either relative > to current working directory, or make the file name absolute. What's > happening is that os.listdir() is giving you file names that are > relative to the base directory you

Re: [Tutor] Swampy: No module name World

2014-06-02 Thread Alan Gauld
On 02/06/14 02:33, Charles Agriesti wrote: from swampy.World import World world = World() ImportError: No module name World These scripts run with no problem as long as the file location is the python27 folder. But not from outside the folder. It sounds like you installed swampy in the wrong

Re: [Tutor] Swampy: No module name World

2014-06-02 Thread Dave Angel
Charles Agriesti Wrote in message: > > from swampy.World import World > world = World() > ImportError: No module name World 1. please use text mail on this mailing-list. Your email software should have an option to change that. 2. You're referring to some nonstandard package called swampy, a