CSSE1001 / MyPyTutor

Interactive tutorial application for Python3.
Other
7 stars 12 forks source link

Test the new installer #121

Closed sapi closed 9 years ago

sapi commented 9 years ago

I've completely rewritten the installer.

MyPyTutor.py is now itself the installer. When you run it for the first time, it will bootstrap itself into the directory you specify. (If you don't want tkinter to show up, pass --no-gui.)

Could @starsnabove and @pjritee please check that this works correctly on their respective operating systems?

You'll need to pull and check out the new_installer branch, then copy MyPyTutor.py to a different directory. (If it is in the same directory, it will not install.)

git pull origin new_installer
git checkout new_installer
pjritee commented 9 years ago

First it gives a terminal based interaction - we can't have that for Windows users. Second I get (maybe things are in transition): $ python3 MyPyTutor.py Default MyPyTutor install directory: /home/pjr/MyPyTutor Change installation directory [yN]: y Checking for MyPyTutor updates...done Checking for tutorial package updates...failed

starsnabove commented 9 years ago

On windows 8, if I leave it as the default installation location it works fine

But if I change the location - depending on where/how I do that it does what @pjritee has or works

pjritee commented 9 years ago

Yes - I changed the default as well

sapi commented 9 years ago

Hmm, anything common about where it's failing? Spaces in the path maybe (though I dunno why that would fail)?

On Thursday, February 26, 2015, Vincent Kruger notifications@github.com wrote:

On windows 8, if I leave it as the default installation location it works fine

But if I change the location - depending on where/how I do that it does what @pjritee https://github.com/pjritee has or works

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76122935.

starsnabove commented 9 years ago

Also (for windows users) the default location of ~/MyPyTutor is not a good location as ~ is not a directory that most windows users know about or touch what would be better would be ~/Documents/MyPyTutor

pjritee commented 9 years ago

Ah - I guess windows users would be running it through IDLE - so that's OK (as long as the HOWTO document is updated appropriately - any takers? And I agree that ~/Documents/MyPyTutor probably makes more sense for Windows users.

starsnabove commented 9 years ago

I will update the how to shortly - just working out any pattern to the failure to to install tutorial files On 26/02/2015 3:06 pm, "Peter Robinson" notifications@github.com wrote:

Ah - I guess windows users would be running it through IDLE - so that's OK (as long as the HOWTO document is updated appropriately - any takers?

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76123202.

starsnabove commented 9 years ago

I cannot find a pattern - 4 times in a row of changing the directory(to different ones and paths) and it succeeded

sapi commented 9 years ago

Windows users can just double click on the MyPyTutor.py file - it'll pop up with a terminal window that they can work with. I don't think hitting enter at a prompt is too difficult.

I don't know if it'll actually work if installed through IDLE (my guess would be not, but you could try).

Good catch on ~/Documents.

If you do find a pattern let me know. I'll have a poke around myself shortly too. It's really odd. The only reason checking for tutorial package updates can fail is if the tutorial package wasn't installed, or can't be opened...which shouldn't be the case if the script ever gets to that point :/

starsnabove commented 9 years ago

I just seems to not ever download it - the script fails at that part

sapi commented 9 years ago

The package should be downloaded by bootstrap_tutorials, not update_default_tutorial_package, though...even if it fails at that part, there should already be a valid tutorials directory!

starsnabove commented 9 years ago

In the times it failed for me there was no CSSE1001Problems or CSSE1001/Answers folders - just tutorlib and the two MyPyTutor files

starsnabove commented 9 years ago

Is the manual installation of downloading a .zip file still going to be available

sapi commented 9 years ago

Hopefully 72769ce has dealt with the tutorial package installation error.

We can make the zip files available - there's no harm - but it would be nicer to use the installer.

(The new installer also remembers your login credentials, for what it's worth.)

starsnabove commented 9 years ago

Installer works on Win7 and appears to run OK except when close the program. I get

Exception ignored in: <bound method Interpreter.del of <tutorlib.interface.i nterpreter.Interpreter object at 0x02C478B0>> Traceback (most recent call last): File "C:\Users\starsnabove\Documents\test mpt\mpt test\tutorlib\interface\inte rpreter.py", line 38, in del os.remove(self.path) # will gen before removing, but meh PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\Users\STARSN~1\AppData\Local\Temp\tmpu2 841xkj' Exception ignored in: <bound method MultiCall.del of <idlelib.MultiCall.Mult iCallCreator..MultiCall object at 0x02C68770>> Traceback (most recent call last): File "C:\Python34\lib\idlelib\MultiCall.py", line 413, in del self.binders[triplet[1]].unbind(triplet, func) File "C:\Python34\lib\idlelib\MultiCall.py", line 102, in unbind self.widget.unbind(self.widgetinst, self.sequence, self.handlerid) File "C:\Python34\lib\tkinter__init.py", line 1092, in unbind self.tk.call('bind', self._w, sequence, '') _tkinter.TclError: can't invoke "bind" command: application has been destroyed Exception ignored in: <bound method _ComplexBinder.del of <idlelib.MultiCall ._ComplexBinder object at 0x02C68750>> Traceback (most recent call last): File "C:\Python34\lib\idlelib\MultiCall.py", line 244, in del self.widget.unbind(self.widgetinst, seq, id) File "C:\Python34\lib\tkinterinit.py", line 1092, in unbind self.tk.call('bind', self._w, sequence, '') _tkinter.TclError: can't invoke "bind" command: application has been destroyed Exception ignored in: <bound method _ComplexBinder.del of <idlelib.MultiCall ._ComplexBinder object at 0x02C68790>> Traceback (most recent call last): File "C:\Python34\lib\idlelib\MultiCall.py", line 244, in del self.widget.unbind(self.widgetinst, seq, id) File "C:\Python34\lib\tkinterinit.py", line 1092, in unbind self.tk.call('bind', self._w, sequence, '') _tkinter.TclError: can't invoke "bind" command: application has been destroyed Exception ignored in: <bound method _ComplexBinder.del of <idlelib.MultiCall ._ComplexBinder object at 0x02C682B0>> Traceback (most recent call last): File "C:\Python34\lib\idlelib\MultiCall.py", line 244, in del self.widget.unbind(self.widgetinst, seq, id) File "C:\Python34\lib\tkinterinit.py", line 1092, in unbind self.tk.call('bind', self._w, sequence, '') _tkinter.TclError: can't invoke "bind" command: application has been destroyed Exception ignored in: <bound method _ComplexBinder.del of <idlelib.MultiCall ._ComplexBinder object at 0x02C68A30>> Traceback (most recent call last): File "C:\Python34\lib\idlelib\MultiCall.py", line 244, in del self.widget.unbind(self.widgetinst, seq, id) File "C:\Python34\lib\tkinterinit.py", line 1092, in unbind self.tk.call('bind', self._w, sequence, '') _tkinter.TclError: can't invoke "bind" command: application has been destroyed Exception ignored in: <bound method _SimpleBinder.del of <idlelib.MultiCall. _SimpleBinder object at 0x0511CDB0>> Traceback (most recent call last): File "C:\Python34\lib\idlelib\MultiCall.py", line 109, in del self.handlerid) File "C:\Python34\lib\tkinterinit.py", line 1092, in unbind self.tk.call('bind', self._w, sequence, '') _tkinter.TclError: can't invoke "bind" command: application has been destroyed Exception ignored in: <bound method _SimpleBinder.del of <idlelib.MultiCall. _SimpleBinder object at 0x0511CDF0>> Traceback (most recent call last): File "C:\Python34\lib\idlelib\MultiCall.py", line 109, in del self.handlerid) File "C:\Python34\lib\tkinterinit.py", line 1092, in unbind self.tk.call('bind', self._w, sequence, '') _tkinter.TclError: can't invoke "bind" command: application has been destroyed

when attempt close, but I believe this is a reoccurring problem.

sapi commented 9 years ago

Everything except the first one are covered by #18; tk just likes writing crap to console when it quits. (More seriously, I believe it's to do with idlelib not cleaning up after itself properly.)

The first one was my bad; I forgot how windows handled removed files. I just fixed that in a push.

starsnabove commented 9 years ago

Works on win 8 even with many spaces just still cannot log in

pjritee commented 9 years ago

We know what Change installation directory [yN]: means but I am not convinced students new to programming will

sapi commented 9 years ago

Do you think it would be ok if we (in order of preference):

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

We know what Change installation directory [yN]: means but I am not convinced students new to programming will

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76264776.

pjritee commented 9 years ago

We know what Change installation directory [yN]: means but I am not convinced students new to programming will

pjritee commented 9 years ago

Now it asks me for a keyring but it doesn't ask me where I want to install. It seems to have decided to put the installation in the parent directory of where the git repository was - I loaded up MPT in IDLE and ran it from there. If I run it from the terminal I have no idea where it installs (after removing ~/.mptrc)

sapi commented 9 years ago

Are you referring to where it installs MPT or keyring?

If the latter, it uses pip, so it should go wherever Python packages normally do for the interpreter in question.

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

Now it asks me for a keyring but it doesn't ask me where I want to install. It seems to have decided to put the installation in the parent directory of where the git repository was - I loaded up MPT in IDLE and ran it from there. If I run it from the terminal I have no idea where it installs (after removing ~/.mptrc)

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76269823.

pjritee commented 9 years ago

Why not just something more long winded like Do you want to change the installation folder: y for yes, n for no ?

pjritee commented 9 years ago

Ah - OK that makes sense - if it needs updating I presume it uses pip to update. What about where the Problem and Answer folders go. If I answer yes to the key ring - is it a separate keyring to the system keyring? Where does MyPyTutor.py go - I guess it's stays where I save it to.

sapi commented 9 years ago

keyring is just a os-independent Python wrapper around the system keyring for each of Windows, OS X, and Unix. It should use whatever is appropriate for the system.

If the install works it'll just be a normal Python package. It won't always work, as some installations require root (Ubuntu does by default, from memory) and I don't want to require that; it's too confusing for students.

The problems and answers folders should go wherever the user selected to install MPT (as before).

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

Ah - OK that makes sense - if it needs updating I presume it uses pip to update. What about where the Problem and Answer folders go. If I answer yes to the key ring - is it a separate keyring to the system keyring?

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76271717.

pjritee commented 9 years ago

OK - now I am totally confused - I am on Ubuntu and pip needs root - so does that mean it didn't install? OK - it puts the tutorlib in the directory where it installs. When I enter my username and password I get that error again about not being able to connect but then it connects and syncs.

Did you remove my code (answers) on the server - the sync doesn't update the answers folder.

The recursion_add problem is still there - I guess a sync wasn't run - maybe it's a bit of a gotcha - I think if we edit a problem and then use MyPyTutor to test it I think it is overwritten by what's on the server - if that's the case we need a "developer" switch on MPT so that we can edit and test problems.

pjritee commented 9 years ago

I don't seem to be able to resize the MPT windows so that it keeps the settings when I start it up again - it's default is quite narrow on my machine - the width and height should go in config

sapi commented 9 years ago

The sync script wasn't actually uploading the tutorials zipfile due to an error. That's been fixed now.

If pip needs root, it probably didn't install requests (it then shouldn't prompt for your username and password at the terminal).

Sync is working fine, but it turns out the installers (both old and new) were using CSSE1001Problems, not CSSE1001Tutorials, meaning we had two sets of answers on the server. I've updated the new one and I'll do the old in a sec.

What error do you mean that you get after entering your username and password? When are you entering them (terminal or GUI)?

On 27 February 2015 at 08:30, Peter Robinson notifications@github.com wrote:

I don't seem to be able to resize the MPT windows so that it keeps the settings when I start it up again - it's default is quite narrow on my machine - the width and height should go in config

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76277656.

pjritee commented 9 years ago

It pops up a "could not complete request" box then after a while (after the sync is finished) this box disappears and I am logged on. This seems to happen each time - not just the first time (installing)

sapi commented 9 years ago

Are you running using MyPyTutor.py in the install directory (eg ~/MyPyTutor/MyPyTutor.py)?

Are the submission statuses synced (blue menu items)? It could possibly be that that is failing if the sync succeeds.

I don't see anything similar on my end so I'm just trying to narrow it down.

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

It pops up a "could not complete request" box then after a while (after the sync is finished) this box disappears and I am logged on. This seems to happen each time - not just the first time (installing)

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76282491.

pjritee commented 9 years ago

If I run the "installer" from IDLE then it doesn't go through the complete process. So for Linux users it's not a big problem - we just say make MyPytutor.py executable and then run it in a terminal.

Because there are 2 kinds of MAC users in the class this is more problematic - those who know what a terminal is can follow the same approach. For those who don't what do we do?

For windows users if you double click on a .py (or .pyw) file will it know what to do - i.e. we want it to run - not load it in IDLE

pjritee commented 9 years ago

I copied MyPyTutor.py to /tmp and ran it from there (I removed .mptrc and all the files/dirs in the install dir before hand so it would be a fresh install)

sapi commented 9 years ago

In both cases I would suggest telling students to right click -> open with -> Python launcher. That's definitely a default option on OS X, and from memory it is on Windows as well. It's what I normally tell people about how to run MPT. (Alternatively, distributing a .pyw might give the correct association on Windows by default.)

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

If I run the "installer" from IDLE then it doesn't go through the complete process. So for Linux users it's not a big problem - we just say make MyPytutor.py executable and then run it in a terminal.

Because there are 2 kinds of MAC users in the class this is more problematic - those who know what a terminal is can follow the same approach. For those who don't what do we do?

For windows users if you double click on a .py (or .pyw) file will it know what to do - i.e. we want it to run - not load it in IDLE

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76283531.

pjritee commented 9 years ago

What's the situation with running MPT on the lab machines in 78-122 - what will happen with the installation?

sapi commented 9 years ago

It should default to installing on H drive if that is available, but for obvious reasons I haven't been able to test. Would your staff account have a H drive to test with?

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

What's the situation with running MPT on the lab machines in 78-122 - what will happen with the installation?

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76286668.

starsnabove commented 9 years ago

I was wanting to test yesterder but I do not have access any more On 27/02/15 08:20, Sean Purdon wrote:

It should default to installing on H drive if that is available, but for obvious reasons I haven't been able to test. Would your staff account have a H drive to test with?

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

What's the situation with running MPT on the lab machines in 78-122

  • what will happen with the installation?

— Reply to this email directly or view it on GitHub

https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76286668.

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76287179.

ironstrider commented 9 years ago

I get the following error when I try to pull this branch. Looks like it is OOS with master?

I don't want to break anything.

[15:08][ben:/path/to/CSSE1001]$ git clone https://github.com/CSSE1001/MyPyTutor
Cloning into 'MyPyTutor'...
remote: Counting objects: 4029, done.
remote: Compressing objects: 100% (89/89), done.
remote: Total 4029 (delta 51), reused 0 (delta 0), pack-reused 3940
Receiving objects: 100% (4029/4029), 2.05 MiB | 362.00 KiB/s, done.
Resolving deltas: 100% (2705/2705), done.
Checking connectivity... done.
[15:08][ben:/path/to/CSSE1001]$ cd MyPyTutor/
[15:08][ben:/path/to/CSSE1001/MyPyTutor(master)]$ git pull origin new_installer
From https://github.com/CSSE1001/MyPyTutor
 * branch            new_installer -> FETCH_HEAD
Removing code/mpt_version.py
CONFLICT (modify/delete): code/mpt_installer.py deleted in eaaff70d071ea16d24d85ffcaf7a1929e3dc3433 and modified in HEAD. Version HEAD of code/mpt_installer.py left in tree.
Automatic merge failed; fix conflicts and then commit the result.
sapi commented 9 years ago

All good, I just applied a hotfix to the installer in master after deleting it in the branch.

I sorted out the merge then pushed just then :)

On Friday, February 27, 2015, Ben Martin notifications@github.com wrote:

I get the following error when I try to pull this branch. Looks like it is OOS with master?

I don't want to break anything.

[15:08][ben:/path/to/CSSE1001]$ git clone https://github.com/CSSE1001/MyPyTutor Cloning into 'MyPyTutor'... remote: Counting objects: 4029, done. remote: Compressing objects: 100% (89/89), done. remote: Total 4029 (delta 51), reused 0 (delta 0), pack-reused 3940 Receiving objects: 100% (4029/4029), 2.05 MiB | 362.00 KiB/s, done. Resolving deltas: 100% (2705/2705), done. Checking connectivity... done. [15:08][ben:/path/to/CSSE1001]$ git pull origin new_installer fatal: Not a git repository (or any of the parent directories): .git [15:08][ben:/path/to/CSSE1001]$ cd MyPyTutor/ [15:08][ben:/path/to/CSSE1001/MyPyTutor(master)]$ git pull origin new_installer From https://github.com/CSSE1001/MyPyTutor

  • branch new_installer -> FETCH_HEAD Removing code/mpt_version.py CONFLICT (modify/delete): code/mpt_installer.py deleted in eaaff70d071ea16d24d85ffcaf7a1929e3dc3433 and modified in HEAD. Version HEAD of code/mpt_installer.py left in tree. Automatic merge failed; fix conflicts and then commit the result.

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76335287.

ironstrider commented 9 years ago

It all works quite nicely. The only thing is that keyring saves your credentials regardless of whether they authenticate correctly.

sapi commented 9 years ago

Hmm, can you file a separate issue for that please? I thought I was testing and then removing them at the bottom of the installer. Maybe I forgot to actually delete them.

On Friday, February 27, 2015, Ben Martin notifications@github.com wrote:

It all works quite nicely. The only thing is that keyring saves your credentials regardless of whether they authenticate correctly.

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76338916.

pjritee commented 9 years ago

Am I back to using the installer program or are we going to merge?

sapi commented 9 years ago

We'll merge. Stick to the new_installer branch for now

On Friday, February 27, 2015, Peter Robinson notifications@github.com wrote:

Am I back to using the installer program or are we going to merge?

— Reply to this email directly or view it on GitHub https://github.com/CSSE1001/MyPyTutor/issues/121#issuecomment-76341470.

mijohen commented 9 years ago

Have you merged or should I test using the new installer branch?

mijohen commented 9 years ago

I just did a pull from the new_installer branch and tried installing and got this error.

Checking for MyPyTutor updates...done Downloading default tutorial package...done Installing default tutorial package...Traceback (most recent call last): File "C:\Users\Michael Henderson\Documents\MyPyTutor\MyPyTutor.py", line 616, in sys.exit(main()) File "C:\Users\Michael Henderson\Documents\MyPyTutor\MyPyTutor.py", line 596, in main bootstrap_tutorials() File "C:\Users\Michael Henderson\Documents\MyPyTutor\MyPyTutor.py", line 299, in bootstrap_tutorials safely_extract_zipfile(filename, options.tut_dir) File "C:\Users\Michael Henderson\Documents\MyPyTutor\tutorlib\gui\app\support.py", line 10, in safely_extract_zipfile with ZipFile(zip_path) as zf: File "C:\Python34\lib\zipfile.py", line 923, in init self.fp = io.open(file, modeDict[mode]) FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\MICHAE~1\AppData\Local\Temp\tmpr4arwo0t.zip'

sapi commented 9 years ago

Thanks @hendo-michael - I just raised #130 based on that; UAC is being a bit over-eager with zip files.

pjritee commented 9 years ago

I now get (ubuntu) $ python3 MyPyTutor.py Default MyPyTutor install directory: /home/pjr/MyPyTutor Type 'yes' if you would like to change the install directory: Installing MyPyTutor...done Checking for MyPyTutor updates...done Creating default config...done Downloading default tutorial package...done Installing default tutorial package...Traceback (most recent call last): File "/home/pjr/MyPyTutor/MyPyTutor.py", line 616, in sys.exit(main()) File "/home/pjr/MyPyTutor/MyPyTutor.py", line 596, in main bootstrap_tutorials() File "/home/pjr/MyPyTutor/MyPyTutor.py", line 299, in bootstrap_tutorials safely_extract_zipfile(filename, options.tut_dir) File "/home/pjr/MyPyTutor/tutorlib/gui/app/support.py", line 10, in safely_extract_zipfile with ZipFile(zip_path) as zf: File "/usr/lib/python3.4/zipfile.py", line 923, in init self.fp = io.open(file, modeDict[mode]) FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpusvzgk6e.zip'

starsnabove commented 9 years ago

That seems the same as the issue of #130

pjritee commented 9 years ago

I confirm that it's installing and running on Ubuntu. I still get a transient "Could not complete request" box while it's sync'ing.

keyring doesn't work for me. First we need to add something to install doc to say that if you are using linux (or MAC???) then first sudo pip3 install keyring (if you want to use the keyring to store username and password) Second in the install it says Please enter your UQ username and password Username: uqprobin Password:

I think it should still ask if you want to use the keyring - then it should say something about adding username and password to keyring before asking for username and password.

I get: $ python3 MyPyTutor.py Default MyPyTutor install directory: /home/pjr/MyPyTutor Type 'yes' if you would like to change the install directory: Installing MyPyTutor...done Checking for MyPyTutor updates...done Creating default config...done Downloading default tutorial package...done Installing default tutorial package...done Checking for tutorial package updates...done

Please enter your UQ username and password Username: uqprobin Password:

Traceback (most recent call last): File "/home/pjr/MyPyTutor/MyPyTutor.py", line 639, in sys.exit(main()) File "/home/pjr/MyPyTutor/MyPyTutor.py", line 623, in main username, password = try_get_credentials() File "/home/pjr/MyPyTutor/MyPyTutor.py", line 467, in try_get_credentials keyring.set_password(MPT_SERVICE, cfg.online.username, password) AttributeError: 'module' object has no attribute 'set_password'

pjritee commented 9 years ago

Further to last comment - since I can't say no to using the keyring I can't run MPT at all because it always asks for username and password when installing. I guess I could uninstall keyring (I presume that would be sudo pip3 uninstall keyring)