[Tutor] entering text on web site

2012-06-13 Thread Benjamin Fishbein
Hello. I have been teaching myself Python and have been stuck on this problem 
for a week--I scoured the web for an answer and even asked a couple computer 
programmer friends.
I managed to write a simple program with urllib that downloads the content from 
web pages; but I want to put text in a text box on the webpage, have it entered 
into the website, and then get the results. Is there a way to do this with 
Python?
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] entering text on web site

2012-06-13 Thread Benjamin Fishbein
Thanks. I'm trying to automatically post text to a web page from Python and 
retrieve the resultant page. It's not just name and password, though; I need to 
do it over and over again with chunks of info from a list.
The page seems to be using POST.
form method='POST'
is written all throughout the code.
The links you recommended use modules like Client Cookie, mechanize, etc. I 
guess Python didn't come standard with a module that could do what I wanted...
Which is the best module to get for this?

Ben


On Jun 13, 2012, at 8:27 AM, Walter Prins wrote:

> Hi,
> 
> On 13 June 2012 13:35, Benjamin Fishbein  wrote:
>> Hello. I have been teaching myself Python and have been stuck on this 
>> problem for a week--I scoured the web for an answer and even asked a couple 
>> computer programmer friends.
>> I managed to write a simple program with urllib that downloads the content 
>> from web pages; but I want to put text in a text box on the webpage, have it 
>> entered into the website, and then get the results. Is there a way to do 
>> this with Python?
> 
> Please clarify, are you:
> a) Trying to automatically post some text to a web page from Python
> and then retrieve the resultant page? (for example, username and
> password and retrieve resultant logon page.)
> b) Trying to use Python to present a webpage that a user then puts
> text in a box which the Python program then captures when the user
> submits the page?
> 
> I'm assuming a.) If so, then I should ask, does this page use POST or
> GET style submission?
> 
> In any case, here's a stackeroverflow question regarding using POST
> and cookies etc:
> http://stackoverflow.com/questions/2954381/python-form-post-using-urllib2-also-question-on-saving-using-cookies
> .. with the default Python documentation doing a decent job of explaining GET:
> http://docs.python.org/howto/urllib2.html
> 
> This also seems useful/relevant:
> http://stackoverflow.com/questions/10916745/scraping-data-from-simple-website-change-post-to-get
> 
> Walter
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] going rate for python tutoring?

2012-07-26 Thread Benjamin Fishbein
Hello,
I'm trying to learn "posting" and am having a very hard time at it. I'm going 
to hire someone to give me a private lesson, so I put up a notice on 
Northwestern's CS bulletin board--probably a student there'll be able to help.
How much money should I offer? I haven't the foggiest notion what the going 
rate is for private computer tutoring.
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] getting results from encoded data i sent to website

2012-07-27 Thread Benjamin Fishbein
I'm trying to learn encoding, and I've had a bit of success. I managed to input 
something to the text box on Python's home page and I got the result I 
expected. But I can't figure out why this program I wrote isn't working; I 
think I did everything right.
I'm inputting the isbn of Cat in the Hat and trying to get the prices for it on 
half.com, the Ebay site for books.
Here's my code:

### This program tries to check the prices for "The Cat in the Hat" on 
http://half.com

#import modules
import urllib
import urllib2

#make variables
action="http://sell.half.ebay.com/ws/eBayISAPI.dll?HalfInstantSaleHub&action=search";
name="isbnupcnumbers"
cat_in_hat_isbn="039480001X"

#get stuff encoded
data={name:cat_in_hat_isbn}
encoded_data=urllib.urlencode(data)

#send encoded stuff to website
content=urllib2.urlopen(action, encoded_data)

#look at results
print content.readlines()

#next I'll parse out the data I want; that I already know how to do.

The program seems to be working until "content" is printed. Then it's a lot of 
strange mumbo-jumbo, quite different from the results I get if I put in the 
isbn manually.
Do you know where I went wrong?
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] running more than one python program at the same time

2012-08-28 Thread Benjamin Fishbein
Hello,
I wrote a program that I want to have running 24/7. But the problem is that I 
also want to write and run other programs. I'm using Idle and it won't let me 
run more than one script at a time. Do you know if there's a way to do this? Or 
do I need to buy a second computer?
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] running more than one python program at the same time

2012-09-03 Thread Benjamin Fishbein
Hi. I started running the program in the terminal rather than IDLE. It works, 
and I can run several programs at the same time. The problem is that when the 
program is finished running, it prints:
exit status: 0
logout

[Process completed]

And I can't access the data that the program returned. Do I need the program to 
be saved to a text file, or is there a way to simply print it out? It's a small 
amount of data, and I'd rather just print it out.
Ben

On Aug 29, 2012, at 9:24 AM, Marc Tompkins wrote:

> On Tue, Aug 28, 2012 at 7:35 PM, Steven D'Aprano  wrote: 
>  
> 
> In Windows, that is the DOS prompt -- either cmd.com or command.exe, I never 
> remember which one is which.
> 
> I'm pretty sure that was intentional, but just in case...
> 
> In MS-DOS/PC-DOS, and in 16-bit versions of Windows (up to Windows 98/Me, in 
> other words), the command interpreter is COMMAND.COM
> 
> In 32-bit versions of Windows, you can still use the 16-bit interpreter if 
> you want - although it's deprecated, and has been removed entirely in 64-bit 
> Windows - but the native 32-bit command interpreter is CMD.EXE
> 
> (I used all-caps for emphasis without requiring HTML formatting, but in fact 
> Windows is generally case-insensitive.)
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] running program in terminal

2012-09-24 Thread Benjamin Fishbein
Hello. I can run programs in IDLE but when I try to do it in a terminal or with 
textwrangler, it usually just logs out and says it's completed, but the program 
hasn't been run. This is particularly so when the program uses urllib. I'm 
using OS X. 

logout

[Process completed]

That's what it prints.
Any idea what to do?
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] running program in terminal

2012-09-24 Thread Benjamin Fishbein
> 
> Can you start up a terminal window then try to run your program and finally 
> paste the whole session into a mail and post it here?
> 
> That should help.
> If your program is complex try a simple one like:
> 
> print ('Hello world')
> input('Hit enter to quit...')

Last login: Mon Sep 24 18:27:48 on ttys000
Benjamins-MacBook-Air:~ bfishbein$ cd '/Users/bfishbein/Documents/Python in 
Use/' && '/usr/local/bin/pythonw'  '/Users/bfishbein/Documents/Python in 
Use/BB.py'  && echo Exit status: $? && exit 1
put in the text input  

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>http://www.w3.org/1999/xhtml"; xmlns:fb="http://ogp.me/ns/fb#";> 
Textbooks.com - Your Search Results for Buyback___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] posting with urllib2

2012-10-02 Thread Benjamin Fishbein
Hi. I'm really confused about which data I need to put in for posting something 
with urllib2.
I added the action on to the website. I know that I use that for the URL 
parameter. But what do I need to put in dicts to pass along data? And what is 
the purpose of the third parameter...the delay??
Thanks
Ben



  
Enter UPC here:




start over
  


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] website is returning error when I post data

2012-10-06 Thread Benjamin Fishbein
Hello. This problem has got me stumped, and I've been trying to figure it out 
for more than a month.
This program checks to see if a college buyback site is buying back particular 
books.
I'm using mac OSX
Here's the code.

import urllib,urllib2
base_url="http://textbooks.com";
action="/BuyBack-Search.php?CSID=AQ2ZJKUWKZJBSD2T2DDMKMKB"
url=base_url+action
name="bb_isbns"
isbns="""0891917608 0307387895 0195070658 0137806922 074324754X\
 067149399x 0446556246 031604993X 0070322538"""
data={name:isbns}
encoded_data=urllib.urlencode(data)
text=urllib2.urlopen(url,encoded_data).read()
file_name="textbooks_trial.txt"
file=open(file_name,"w")
file.write(text)
file.close()
print "finished running program"
print "check file 'textbooks_trial.txt'"

When I go to the website(without using Python) and I paste the text (isbns) 
into the text box then enter it, it comes back with the error:
  Oops... there may be a mistake here.  
Sorry, your search could not be completed at this time. Please try again. 
(Error: BB-09-00-05)

But the text I entered is still in the text entry box. When I click on the 
orange button ("Sell your Textbooks") a second time, it goes through.

The problem is that when I try to do this through Python, it returns the code 
with the error, and there's no orange button to click.
I tried submitting it again, hoping the second time would work, using the 
following code:

import urllib,urllib2
text="there may be a mistake here"
base_url="http://textbooks.com";
action="/BuyBack-Search.php?CSID=AQ2ZJKUWKZJBSD2T2DDMKMKB"
url=base_url+action
name="bb_isbns"
isbns="""0891917608 0307387895 0195070658 0137806922 074324754X\
 067149399x 0446556246 031604993X 0070322538"""
data={name:isbns}
encoded_data=urllib.urlencode(data)
while "there may be a mistake here" in text:
text=urllib2.urlopen(url,encoded_data).read()
file_name="textbooks_trial.txt"
file=open(file_name,"w")
file.write(text)
file.close()
print "tried doing the program"
print "finished running program"
print "check file 'textbooks_trial.txt'"

The result is an endless loop, where it prints out:
"tried running the program"

If anyone can figure out what I need to do, I'd be extremely grateful.
Thanks,
Ben


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] finding a number with str.find

2012-10-08 Thread Benjamin Fishbein
Is there a way to find the next character that is a digit (0-9) in a string? It 
seems that the str.find method can only find one particular character, rather 
than any character from among many.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] finding digit in string

2012-10-08 Thread Benjamin Fishbein
I figured out a solution for the question I asked on here.
To find the next digit (0-9) in a string, I use:
text.find("0" or "1" or "2", etc...)
But is there a more elegant way to do this? The way I found uses a lot of 
typing.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] What can I do if I'm banned from a website??

2012-10-10 Thread Benjamin Fishbein
I've been scraping info from a website with a url program I wrote. But now I 
can't open their webpage, no matter which web browser I use. I think they've 
somehow blocked me. How can I get back in? Is it a temporary block? And can I 
get in with the same computer from a different wifi?

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] saving webpage as webarchive

2016-02-29 Thread Benjamin Fishbein
This seems like it should be simple, but I can’t find any answer with the docs 
or google.
I’m on a Mac. OSX Yosemite 10.10.5
I want to save a webpage as a webarchive, and not just get the text.
I hope there’s a way to do it without saving all of the images separately.
And even if I do have to download them separately, then how would I combine 
everything into the HTM webarchive?

stuff = urllib.urlopen(url).read()
f = open(“file_name”, “w”)
f.write(stuff)
f.close()

The file_name is just the the text.
I realize that the solution to this will require “wb” due to the file type.
Other than that, I’m completely stuck.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] simulating key presses

2016-03-08 Thread Benjamin Fishbein
Despite scouring stack overflow and other places, I can’t figure out how to 
simulate key presses.
I’m using Mac 10.10.5.
Most answers to this involve sending keys to an element, but my problem is that 
I have no element to send to; I’m trying to automate key presses for choosing 
(browsing) a file in the Finder window.
Any help is much appreciated.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] looking for image library based on PIL Image

2016-10-30 Thread Benjamin Fishbein
I’m trying to automate a lot of images using PIL’s Image library, but I don’t 
want to write all the filters and manipulation algorithms myself. Do you know 
of any good code that people have written that does this? I’m not getting much 
luck simply googling it, since all the results lead me to basic image 
manipulators, while I want something more complex.
Thanks.
-Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] how to move an executable into path

2016-11-22 Thread Benjamin Fishbein
Everything was going fine with my selenium webdriver programs, but then today I 
updated to Firefox 50. Everything stopped working. So I updated to selenium 3, 
hoping this would work. But apparently I need something called geckodriver.
I managed to download this, but it’s in the wrong place: in my downloads folder.
So here’s what happens when I try to do anything with selenium:
>>> from selenium import webdriver
>>> driver=webdriver.Firefox()

Traceback (most recent call last):
  File "", line 1, in 
driver=webdriver.Firefox()
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/firefox/webdriver.py",
 line 135, in __init__
self.service.start()
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/common/service.py",
 line 71, in start
os.path.basename(self.path), self.start_error_message)
WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

So I’m not sure where the geckodriver file needs to go. Can it be anywhere on 
the path? could I just put it in the site-packages folder for example?
And here’s the big problem: all of these folders are hidden, and I have no idea 
how to get into them.

I’m on a mac and using python2.7.

I should probably learn how to handle paths and file systems, etc., but right 
now I just want to get my programs running again.
Any help is greatly appreciated.

-Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] automate add-to-cart with python

2013-01-28 Thread Benjamin Fishbein
Hello,
I'm trying to automate putting a series of items into my cart. Here's the html 
for the add-to-cart button on the website:
http://cart.half.ebay.com/ws/eBayISAPI.dll?HalfAddItemToCart&ap=additem&itemid=343343950913&pr=57017296&fromshop=1";>Add
 to cart
Using the cookielib and urllib2 module, I did:

a= text.find("href")+6
b = text.find('"', a)
url = text[a:b]
new_text = opener.open(url).read()

It goes to the page that shows my cart, but there are zero items--the item is 
not added to the cart.
I'm guessing this has something to do with:

class="PDP_button_addToCart2"

I'm not sure how to have Python click the button.
In general, despite scouring the Internet, I haven't been able to figure out 
how to get Python to cause javascripts I find in the html to be run.
Any help would be greatly appreciated.
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] automate add-to-cart with python

2013-01-29 Thread Benjamin Fishbein
>> 
> 
> A direct approach would probably use the webdriver API to automate the
> browser.  Selenium has one:
> 
I decided to use Selenium. It may be overkill for this particular problem, but 
I'll want to use it for other things.
This is my first time trying to install a new module to Python. I've been 
working on it all morning with no success.
I'm on Mac OSX and I downloaded :
selenium-2.29.0.tar.gz
and then opened it to get:
selenium-2.29.0

In the README file,  it said for installing to Python, to type:
pip install -U selenium

So in terminal, I went to:

cd /Users/bfishbein/Downloads/selenium-2.29.0

and typed:
pip install -U selenium

I got:
-bash: pip: command not found
so I tried downloading pip

After downloading pip, I tried to install it:
cd /Applications/pip-1.2.1
install pip

I got this strange message:
usage: install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
   [-o owner] file1 file2
   install [-bCcpSsv] [-B suffix] [-f flags] [-g group] [-m mode]
   [-o owner] file1 ... fileN directory
   install -d [-v] [-g group] [-m mode] [-o owner] directory ...
Benjamins-MacBook-Air:pip-1.2.1 bfishbein$ 

Apparently it didn't install.
Do you know what I'm doing wrong?
Any help would be appreciated.
I didn't expect it to be so tough to install a python module.
Ben



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] automate add-to-cart with python

2013-01-29 Thread Benjamin Fishbein
> 
> 
>http://www.pip-installer.org/en/latest/installing.html
> 
I went to this pip site. It told me to install virtualenv.
http://www.virtualenv.org/en/latest/#installation
The virtualenv site told me:
You can install virtualenv with pip install virtualenv, or the latest 
development version with pip install 
https://github.com/pypa/virtualenv/tarball/develop.


But since I didn't yet have pip, I couldn't use it to install virtualenv.
Then it said:
You can also use easy_install, or if you have no Python package manager 
available at all, you can just grab the single file virtualenv.py and run it 
with pythonvirtualenv.py.

I don't have easy_install. When I tried to download easy_install, it came in an 
EGG format that I couldn't open despite downloading several opener apps.
I tried this page:
https://raw.github.com/pypa/virtualenv/master/virtualenv.py
I think this is what I'll have to use for installing virtualenv, but I have not 
idea what to do with it. I cut and pasted into a python file, then ran it in 
IDLE. When I ran main(), it returned the error:
Traceback (most recent call last):
  File "", line 1, in 
virtual_1.main()
  File "/Users/bfishbein/Documents/virtual_1.py", line 935, in main
sys.exit(2)
SystemExit: 2

I don't have much experience with command prompt interfaces which I think is 
causing most of my trouble. There's probably something simple I'm missing, like 
a semicolon or quotes.
Please help if you can.
Thank you,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] automate add-to-cart with python

2013-01-30 Thread Benjamin Fishbein

On Jan 29, 2013, at 11:49 PM, Marc Tompkins wrote:
> 
> I'm pretty sure that's a typo.  It should say:
> python virtualenv.py
> 
Woohoo!!! It works.
You're right. It worked this way and I was able to install pip.
And I got selenium to work.
Apparently the problem is that selenium isn't compatible with Python 2.5, so I 
installed 2.7 and when I typed "import selenium," it worked! 
Now I just have to figure out how to write the code with the selenium module.
Thanks for your help, everyone.
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] changing unicode to ascii

2013-01-30 Thread Benjamin Fishbein
I was trying to write text to a file and got the following error:

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa0' in position 
5495: ordinal not in range(128)

I tried several things I found online, such as:
text.encode("ascii", "ignore")
which gave me the same error

and
text.replace("\xa0", "")

again, UnicodeEncodeError

I tried
text.decode("ascii", "ignore")
and got the same result.

I'm using Python 2.7, so there's some special technique for this version?
I think the utf-8 data is unnecessary; I can strip it if I can't convert it to 
ascii.
Of course, I can't figure out how to strip it either.
Any help is much appreciated.
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] changing unicode to ascii

2013-01-30 Thread Benjamin Fishbein
>  Using text.encode("ascii", "ignore") should absolutely work. You could also 
> just write the file in UTF-8 if you don't absolutely need ascii by using 
> text.encode("utf-8").
> 
> Hugo
You're right. It does work. I forgot to assign the result to a variable:
text = text.encode("ascii", "ignore")
Thanks.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] python on ipad

2013-03-10 Thread Benjamin Fishbein
Hello. I wrote some python programs for my small business that I run on my 
computer...macbook air. I'm planning to backpack around Mexico and perhaps 
south america. I'll still be working though. Basically my computer does all the 
work, I just need to have internet connections and run the programs, and 
periodically click here and there.
I don't want to take my macbook with me because I'd have anxiety that it'd get 
stolen and I wouldn't have any fun.
So I'm debating if I should get a cheap computer for a couple hundred bucks and 
run the python scripts on it. I think this is possible because I hear the code 
is the same whether it's mac or PC or whatever.
Or I might take my ipad with me. Or just run it on my iphone.
Do you know if it's possible to run python scripts on a ipad/iphone, and if so 
how to do it?
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] building a website with python

2013-04-09 Thread Benjamin Fishbein
Hello. I learned Python this past year (with help from many of you) and wrote 
many programs for my small business. Now I want to build a website. I acquired 
the domain name through godaddy.com (bookchicken.com) but have not found 
hosting yet.
I learned html, css, and javascript via codeacademy.org, but have never built a 
website.
I would like to build it with Python, and was wondering if you could give me 
some pointers about what I need to learn first: Django is the thing to use? And 
do I need specific hosting to use python or are all hosts basically the same.
Thanks,
Ben


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] building a website with python

2013-04-09 Thread Benjamin Fishbein
> 
> You've gotten some good feedback, but I suspect you will get better 
> information if you provide more information about your goals for the site.
> 

Thanks for your help, everyone. There are some specific things I want the site 
to do, and I'm not sure which would be the best developing tool or hosting for 
these.
The python software I developed is for selling used books.
It takes book ISBN numbers as input and returns the best prices being offered.
It uses the selenium module...I'm not sure how that would translate into a 
website.
There are many websites that offer similar book price comparisons, but mine is 
different...it's user-friendly. Any volunteer at a thrift shop or library can 
use it...just a series of simple directions and yes/no questions, taking the 
user all the way from scanning or typing in an ISBN to dropping the parcel off 
at the post office. (The local libraries I worked with more than doubled their 
used-book revenues.) I want to expand this nationwide, and bookchicken.com 
seems to be the way to do it.
So much of the program is simple enough. But there's two parts of the program 
that I anticipate being important to what host, development tool I use:
1. ISBNs (the books the thrift shop/ library has) being sent to various 
websites and returning the data to my site to be analyzed by my program.
2. Maneuvering through the website of the company buying the books. I don't 
want to send the user off to a warehouse's site with a list of books to sell to 
them. They'll still be entering their address and name, but it'll be on my 
site, that I then send to the warehouse's page, get a packing slip and shipping 
label from the warehouse, and give these documents to the user to print out.

I'm not sure if this changes anyone's ideas about which host/ developer I 
should use. Please let me know.
Thanks,
Ben


 


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] selenium programs stopped working

2013-06-03 Thread Benjamin Fishbein
I'm using selenium webdriver with python 2.7. I have some programs I wrote with 
it and they've been working properly for some months.
But today I tried to write a new program with the selenium module.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("http://www.python.org";) # actually I go to other sites, not 
python.org
# now there's more but the program never gets to it

The Firefox web browser opens, but it doesn't go to any page. The url doesn't 
even appear in the box at the top of the webbrowser where urls go.
Do you know what is causing this problem? The only thing I can think of is that 
there's some problem in the settings. I shut down the computer and turned it 
back on, but the problem remains.
Any help would be greatly appreciated.
Thanks,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] selenium programs stopped working

2013-06-03 Thread Benjamin Fishbein
btw I'm on a Mac running 10.7.
And after a couple minutes of not loading any webpage, the program gives me 
this error:

Traceback (most recent call last):
  File "/Users/bfishbein/Documents/s_buy2.py", line 7, in 
driver = webdriver.Firefox()
  File 
"/Library/Python/2.7/site-packages/selenium/webdriver/firefox/webdriver.py", 
line 58, in __init__
self.binary, timeout),
  File 
"/Library/Python/2.7/site-packages/selenium/webdriver/firefox/extension_connection.py",
 line 47, in __init__
self.binary.launch_browser(self.profile)
  File 
"/Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py",
 line 48, in launch_browser
self._wait_until_connectable()
  File 
"/Library/Python/2.7/site-packages/selenium/webdriver/firefox/firefox_binary.py",
 line 95, in _wait_until_connectable
self.profile.path, self._get_firefox_output()))
WebDriverException: Message: "Can't load the profile. Profile Dir: 
/var/folders/vm/8th3csp91qb47xbhqhb4gcmhgn/T/tmpPeqacA Firefox output: *** 
LOG addons.xpi: startup\n*** LOG addons.xpi: Skipping unavailable install 
location app-system-share\n*** LOG addons.xpi: checkForChanges\n*** LOG 
addons.xpi: No changes found\n" 

I can't make any sense of this.
Ben



On Jun 3, 2013, at 8:08 PM, Benjamin Fishbein wrote:

> I'm using selenium webdriver with python 2.7. I have some programs I wrote 
> with it and they've been working properly for some months.
> But today I tried to write a new program with the selenium module.
> 
> from selenium import webdriver
> from selenium.webdriver.common.keys import Keys
> 
> driver = webdriver.Firefox()
> driver.get("http://www.python.org";) # actually I go to other sites, not 
> python.org
> # now there's more but the program never gets to it
> 
> The Firefox web browser opens, but it doesn't go to any page. The url doesn't 
> even appear in the box at the top of the webbrowser where urls go.
> Do you know what is causing this problem? The only thing I can think of is 
> that there's some problem in the settings. I shut down the computer and 
> turned it back on, but the problem remains.
> Any help would be greatly appreciated.
> Thanks,
> Ben
> 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] selenium programs stopped working

2013-06-04 Thread Benjamin Fishbein
I think you're right: Firefox may have automatically updated itself.
I checked and I was using Selenium 2.29
The most recent is 2.33
So I downloaded the newest one and did 
pip install -U selenium
in terminal but I got this:

Installing collected packages: selenium
  Found existing installation: selenium 2.29.0
Uninstalling selenium:
Exception:
Traceback (most recent call last):
  File 
"/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/basecommand.py", 
line 107, in main
status = self.run(options, args)
  File 
"/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/commands/install.py",
 line 261, in run
requirement_set.install(install_options, global_options)
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 
1162, in install
requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 
495, in uninstall
paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/req.py", line 
1492, in remove
renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg/pip/util.py", 
line 273, in renames
shutil.move(old, new)
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
 line 290, in move
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
 line 249, in rmtree
  File 
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py",
 line 247, in rmtree
OSError: [Errno 13] Permission denied: 
'/Library/Python/2.7/site-packages/selenium-2.29.0-py2.7.egg-info/dependency_links.txt'

Is it saying that 2.29 isn't letting itself be upgraded? Will I have to 
completely delete Selenium from my computer and then reinstall it with the 
updated one?
Ben


On Jun 4, 2013, at 3:27 AM, Walter Prins wrote:

> Hi,
> 
> On 4 June 2013 02:27, Benjamin Fishbein  wrote:
> WebDriverException: Message: "Can't load the profile. Profile Dir: 
> /var/folders/vm/8th3csp91qb47xbhqhb4gcmhgn/T/tmpPeqacA Firefox output: 
> *** LOG addons.xpi: startup\n*** LOG addons.xpi: Skipping unavailable install 
> location app-system-share\n*** LOG addons.xpi: checkForChanges\n*** LOG 
> addons.xpi: No changes found\n"
> 
> That there is your problem.  There's several instances of this problem on the 
> net if you google e.g. "Can't load the profile. Profile Dir: /var/folders" as 
> a search string.
> 
> The gist of it seems to me to be usually a firefox/selenium version mismatch 
> of some sort.  Has firefox been updated recently?  Have you checked if 
> there's any updates available for selenium?
> 
> See for example:
> https://groups.google.com/forum/?fromgroups#!topic/splinter-users/MAP8yyVhqic
> 
> 
> Walter
> 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] saving Tkinter canvas as jpg

2013-12-08 Thread Benjamin Fishbein
Hello.
I'm writing a program to draw pictures. I'm using Python 2.7.3 on Mac OSx. I'm 
trying to find a good way to save the canvas as a jpg (or other pic formats). 
The advice I've found on stackoverflow is ImageGrab from PIL, but apparently 
that doesn't work for macs. I get the "no module named _grabscreen" ImportError.
Can you recommend a good module for saving the canvas into a picture file?
Thank you,
Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] saving Tkinter canvas as jpg

2013-12-08 Thread Benjamin Fishbein
> Have you imported PIL ?  Show a small coding example here with the traceback. 
> Cut and paste the traceback, don't paraphrase it.

Here's what printed out:

Traceback (most recent call last):
  File "", line 1, in 
from PIL import ImageGrab
  File "/Library/Python/2.7/site-packages/PIL/ImageGrab.py", line 34, in 

import _grabscreen
ImportError: No module named _grabscreen

From what I've seen online, this isn't available for mac...of course everything 
about this module is several years old, and it hasn't been updated with a new 
version in a few years, so I think there must be something better than it.


> I'm writing a program to draw pictures. I'm using Python 2.7.3 on Mac OSx. 
> I'm trying to find a good way to save the canvas as a jpg (or other pic 
> formats). The advice I've found on stackoverflow is ImageGrab from PIL, but 
> apparently that doesn't work for macs. I get the "no module named 
> _grabscreen" ImportError.
> Can you recommend a good module for saving the canvas into a picture file?
> Thank you,
> Ben
> 
> -- 
> Joel Goldstick
> http://joelgoldstick.com

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] pygame doesn't work

2013-12-11 Thread Benjamin Fishbein
Hello. I'm using Python 2.7.6 on Mac OSX. I try importing pygame and get this:

>>> import pygame

Traceback (most recent call last):
  File "", line 1, in 
import pygame
  File 
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py",
 line 95, in 
from pygame.base import *
ImportError: 
dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so,
 2): no suitable image found.  Did find:

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/base.so:
 no matching architecture in universal wrapper


I've looked online to try to solve this. Apparently it's a 32-bit/64-bit issue, 
but nothing has shown me how to fix the problem. Any help would be greatly 
appreciated.

Ben

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] downloading modules for both python 2 and 3

2017-04-09 Thread Benjamin Fishbein
I’ve been writing an app using Kivy, and now I want to test it out on an 
iPhone. However, this can currently only be done in Python 2.
https://kivy.org/docs/guide/packaging-ios.html 

But when I import kivy in Python2, I get an ImportError.
ImportError: No module named kivy
So I need to install kivy for Python 2.
But when I do:
sudo pip install kivy
I get the following:
Requirement already satisfied: requests in 
./anaconda/lib/python3.5/site-packages (from Kivy-Garden>=0.1.4->kivy) 

Do you know how I can convince my computer to download a module for Python 2 
when I already have it for Python 3?

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor