Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

Looking for the book? They have it at the Engineer's Bookstore at 748 Marietta St NW. Here is there website: http://www.engrbookstore.com/ - Monica

Hotspots: Slides and CodeTA CornerComments?AnnouncementsFAQStatic Webspace
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Fall 2004 Homework 1 Questions

Got questions on how to do posterizing? Ask 'em here!


when is homework 1 due?
Friday Sept. 10 at 7pm Amanda Bennett

when i attempt to attach my picture, a window pops up and prompts me for username and password. i put in my gtg# and also the password, but it's not working. is there supposed to be another username and password?

The username is attach and the password is carmen Kelly Lyons

At the end of the function, should we return the picture, or show it, or what?
You don't need to return it. You also don't need to show it.Bill Leahy

Should we have pickAfile in the code?
No, the instructions say that the function will take in as input a pictureBill Leahy

I must be completely lost. How do you tell it which picture you want to posterize??? And also on the third line, I have "for p in getPixels(picture):" written and when I load it, it says that the error is on that line. But how is that a syntax error?

You would typically create the posterize function and load it so it's ready to run. Then you would do something like this in the command window at the bottom of the JES screen:

file = pickAFile()
pic = makePicture(file)
poster = posterize(pic)

when posterize finished poster will be the name of the posterized picture.

As for the syntax error, get with a TA or an instructor and show them your code.


I completed the function and got the JES to show me the picture in my program. The last line of the function is "return(pic)"..shouldn't that allow me to see the picture I manipulated later?? It shows me the picture, but then when i try to writePictureTo, it tells me there is no variable of that name.

You shouldn't need to return anything from posterize. The picture that you pass in will be posterized so use the name of the picture that you passed in.Bill Leahy

each time I try to load it defaults and asks me to save, I do, but then it wont load. So, after I put in file = pic......=posertixe (picture) it tells me that a local or global name could not be found. What do I do?
Try quitting JES and restarting to fix the never ending load problem. You can copy/paste both the top and bottom windows of JES and email them to me. Might be easier to just see an instructor of a TA (or use IM)Bill Leahy


what do i do when it says an error has occured in passing an agrument to a function. there are no syntax errors

i keep getting syntax errors when i put in return (picture), but I look in the text and it appears to be right, then when I change return to repaint (picture) an error comes up telling me that I need a local or global namce for picture in the line above which is show(picture) but I already defined picture on the second line What am i doing wrong.
This error can occur if you are passing arguments when none are required or when you are not passing arguments that are required. It can also occur if you are trying to do something like adding a number to a string. Best bet is to get an instructor or TA to look at your code via email, IM or in person.Bill Leahy


Thanks Mr. Leahy, I am not exactly sure what you just said, but I am going to go see a TA in person - that I did understand

Maybe an example will help:

If you write a function like this:

def test(something):
  print something

and then call it like this:

test()

or

test('hello', 'world')

you will get that error because you wrote a function that will take one thing as input and you tried to run it with 0 or 2 things.

You will also get that error if you do something like this:

print 7 + 'hello'

because python doesn't know how to add a number and a string.
Does that makes sense?
Bill Leahy



How do i upload my picture to the poster gallery?? If i have to browse the picture, is it going to give me the updated picture or the old one, that is not posterize??

You run your posterize function and then save the posterized picture using the writePictureTo(picture, filename) function. The picture in the function call is the name of your picture. The filename is the name of the file where you want to store your picture. Note: If you just enter a file name in quotes like 'myfile.jpg' it will store the file in the directory where JES is located. Then, when you upload to the swiki, just browse to the new file you have just created.Bill Leahy

so instead of having file=pickAFile(), pic=makePicture(file), show(pic) etc.. we should just have file="..filename.jpg", pic=makePicture(file), show(pic) ? type format and that is what you mean by inputting a picture?

or should we just go straight from def=posterize(pic) to for p in getPixels(pic) and expect that the TA will do the whole file=pickAFile() stuff?

Yes, the instructions call for your posterize function to accept a picture as input. So you should not have pickAFile nor makePicture inside your function. You can do those steps in the command area and then call your function. The picture will be modified and you can save it using the previously explained writePictureTo function.Bill Leahy

I finished HW1 and it is working fine, but when I go to turn it in via JES it says there is an error in the turnin process and I should check my settings on JES. Everything seems to be fine to me and I do not know what is the matter. Could you please tell me how to fix this? Thanks.
Was it working before? If not, use the alternative method to turn in the assignment (upload it directly onto your TA's turnin coweb page. Angela Liang

Ok. I was in Gutenburg's grading section, but he is no longer my TA. Do I turn in my lab to him or to someone else?
Try again. I made some changes so turning it in through JES might work. If it doesn't work, upload it under your TA's name. If you're in Section B3 and your TA is NOT Summer, upload your assignments under Robert Edmonds. He will be your new TA. Angela Liang

When I hit the attach button on the gallery page it asks me for a user name and password to access. I don't think that's what it is supposed to be doing. Help!

This will happen if you are off campus. Use username: attach, password: carmenBill Leahy


How do i know if the code actually posterized the picture or not?
Also, what all are we supposed to turn in on JES, just the code or also the pic or what? thanx

After you run the code do a "show(pic)" and it should be obvious. From the assignment: 'Turn in your program via JES as "hw1".' You may also optionally upload your posterized picture to the swiki. See the assignment for details.Bill Leahy




I cant ever turn-in via JES, I try and try but it never works. So, I try to upload to the page and I cant find a zip file. Can anyone help me?
I ALWAYS get the error that says "An error has occurred in the turnin process. It is likely that the program turnin has failed. Please check JES's settings and resubmit the assignment.
Error: File not found - gtg780q-HW_1.zip (Access is denied)"

Brent Baxley gtg780q
"Access is denied" is a very weird error, Brent. Where were you running this? My guess is either (a) the Library, and for some reason, the .zip file got created in a place where JES can't get to it or (b) (and I think that this is more likely) you're trying to run JES off the CD. If you're running off the CD, then JES can't save the .zip file (it can't write to the CD), so it can't turn in for you. Mark Guzdial


Should we use a generalized function to calculate the posterization for the ranges given? (code reuse)
Rgds,
Farnaz.
You can but it isn't requiredBill Leahy
If we work with someone, do we each have to do a turnin or just one of us?
John Bradner gte375v
I cannot get the posterized picture to show. I load my function without errors. After selecting a file and naming it picture, 1 of 2 things happen.

1- I tell JES to posterize(picture) then show(picture). But then it just returns the original picture.

2- I tell JES to posterize(picture). Then poster=posterize(picture), show(poster) and I get this error: Input is not a picture.
An error occurred attempting to pass an argument to a function.

I am pretty sure that my function is right but I am missing a step when trying to view it. Can someone please help?


So you do something like this: file = pickAFile(); pic = makePicture(file); posterize(pic); show(pic) (where the ;'s mean new lines)? And your posterize function takes the passed in picture and modifies it? In other words, you don't do pickAFile() or makePicture inside of posterize? If none of the above helps you'll need to contact a TA or an instructor via email, IM or in person.Bill Leahy

EVERYONE needs to turn in a program for HW1. Be sure that you give the people that you worked with on the program credit under the "notes to TA" section of JES. Lauren Walker

when you are writing code, how do you write "equal to"? Thanks!

I'm quessing that you mean greater than or equal to, and less than or equal to. Here ya go...>= and =. As for plain old equals...Use one = sign to set something equal to something else (file = pickAFile()). Use == to test equality (123==345). Lauren Walker


I have gotten the posterize picture to work, but everytime that I try to bring back up my file and check to make I can can see the picture, it won't let me put in show(picture) and look at it. It says local or global problem, can anyone help me?

Did you pass a picture into the posterize function (which then modified it) or did you create the picture inside the function? The former will work (and is what the assignment calls for).Bill Leahy

DO we have to upload our picture to HWK 1 posters gallery?
No, but everyone will think you're really cool if you do.Bill Leahy
when I attempt to run my program it says that: "An attempt was made to call a function with a parameter of an invalid type. This means that you did something such as trying to pass a string to a method that is expecting an integer."
I tried all the different suggestions
I keep getting the same picture back, too! JES looks like it's thinking hard, and then when I do "file = pickAFile(); pic = makePicture(file); posterize(pic); show(pic)" I get the same picture as before. My code loads just fine, but I must be doing something weird somewhere! I'd appreciate any advice... ;)

Make sure the picture isn't too big (maybe that's why JES is "thinking hard". You also need to use the writePictureTo function to save the picture. Angela Liang
ok, i got my code right (i was ecstatic about that), and im probably just being a normal blonde in asking this, but exactly how do we get the picture we posterized from the program to the HWK 1 posters gallery?
I have written a program. I am not sure if it works because I am not sure what is suppost to do. I dont not understand if I suppost to get a picture and posterize it or just write a program that could prosterize it. help me #Jennifer Rogers#
Strictly speaking all you need to do is write the posterize function and turn it in. Now if you have used your posterize function to posterize some cool picture and you're proud of the results you can save the picture as a file using the writePictureTo(pic, 'filenam.jpg') function. Once you have save the file you go to this page: Fall 2004 HW1 Posters and follow the instructions there to upload your picture. Good luck.Bill Leahy
http://www.google.com
<br> <form action="/cs1315/1823.append" method=post><input type="hidden" value="1" name="appendId"><textarea name="append" rows=4 cols=70 wrap=virtual></textarea><br><input type="submit" value="add to the page"><br></form><img src="/cs1315/uploads/1823/canvas.jpg" width=504 height=684 alt="Uploaded Image: canvas.jpg"><br> </body> </html>