GithubHelp home page GithubHelp logo

exaviorn / raspiwrite Goto Github PK

View Code? Open in Web Editor NEW
208.0 208.0 130.0 198 KB

A Python Script that prepairs and installs a Raspberry Pi compatiable distro to an SD Card

Home Page: exaviorn.com/raspiwrite

License: GNU General Public License v3.0

Python 100.00%

raspiwrite's People

Contributors

alecthegeek avatar andypiper avatar exaviorn avatar sverrejoh avatar tech2077 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspiwrite's Issues

already unmounted card

I'm getting this error. I ran the script once, it unmounted my SD card, then it wasn't happy with the distro image i gave it, so i ran it again and i think the problem is that the sd card was already unmounted.

It is advisable to remove any other USB HDDs or memory sticks, the wizard might select that one,  if you have multiple hard drives installed, please take a LOT of care selecting the right drive 
Now enter your SD Card, press enter when you are ready...


---------------------------------------------------------
The following drives were found:

Filesystem      Size   Used  Avail Capacity  Mounted on

Volumes/BOOTCAMP
---------------------------------------------------------

Traceback (most recent call last):
  File "raspiwrite.py", line 423, in <module>
    SD = matchSD(volumes).group(1) #selects the first SD/USB drive located
AttributeError: 'NoneType' object has no attribute 'group'

SyntaxError on OS X

I just cloned git clone git://github.com/exaviorn/RasPiWrite.git (currently at 413db87) to a computer running OS X 10.6.8. Unfortunately:

$ chmod +x raspiwrite.py 
$ sudo ./raspiwrite.py 
  File "raspiwrite.py", line 177
    else
       ^
SyntaxError: invalid syntax

I get the same thing with

$ sudo python raspiwrite.py 
  File "raspiwrite.py", line 177
    else
       ^
SyntaxError: invalid syntax

I have

$ python --version
Python 2.6.1

raspiwrite syntax error

When I follow the execution instructions I get this:

bakaster$ python raspiwrite.py
File "raspiwrite.py", line 177
else
^
SyntaxError: invalid syntax

Syntax error on 10.7 Python 2.7.3

λ ./raspiwrite.py
File "./raspiwrite.py", line 177
else
^
SyntaxError: invalid syntax

Is it something like Python 3k ?
I did not go deeper into this issue but looks maybe like indent error

User specified image doesn't work

Hi,

I've successfully used RasPiWrite to download and write an image to an SD card, but it seems that when trying to write a user-specified image, the path of the image file is repeated. Here's the out put after I try 'accept':

Running dd bs=1m if=/Users/stuart/Downloads/RasPiWrite/OpenELEC.10977.img.gz//Users/stuart/Downloads/RasPiWrite/OpenELEC.10977.img.gz of=/dev/disk1...Waiting dd: /Users/stuart/Downloads/RasPiWrite/OpenELEC.10977.img.gz//Users/stuart/Downloads/RasPiWrite/OpenELEC.10977.img.gz: Not a directory

I'd try and fix it myself, but my Python skills are somewhat lacking!

Invalid Syntax

$ sudo ./raspiwrite.py
File "./raspiwrite.py", line 177
else
^
SyntaxError: invalid syntax

System:
2012 Macbook Pro 15" 8gb 2.3Ghz i7
OS X Mountain Lion 10.8.2

Note: I don't use python so unsure as to what the problem is. tried adding a colon after the else but to no avail.

ExpatError: not well-formed, in checkforUpdate()

Even after applying the indentation and syntax fixes others have contributed, I get this:

//////////////////////// 
* Raspberry Pi SD Writer 
* Matt Jump
* exaviorn.com
////////////////////////
(Version 1.15 -MACOSX-)

Checking for updates...
Traceback (most recent call last):
  File "./raspiwrite.py", line 440, in <module>
    checkforUpdate()
  File "./raspiwrite.py", line 68, in checkforUpdate
    dom = parseString(data)
  File     "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/minidom.py", line 1924, in parseString
    return expatbuilder.parseString(string)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 14, column 59

patch, looks like others have posted some related to this in issues

diff -u ../exaviorn-RasPiWrite-413db87/raspiwrite.py fixed_raspiwrite.py

--- ../exaviorn-RasPiWrite-413db87/raspiwrite.py    2012-07-15 17:24:52.000000000 -0400
+++ fixed_raspiwrite.py 2012-08-17 20:48:26.000000000 -0400
@@ -174,7 +174,7 @@
    global path
    if OS[0] != 'Darwin':
        copyString = 'dd bs=1M if=%s of=%s' % (path,SDsnip)
-   else
+   else:
        copyString = 'dd bs=1m if=%s of=%s' % (path,SDsnip)
    print 'Running ' + copyString + '...'

 @@ -187,7 +187,8 @@
    if archiveType == 'zip': 
        #path =  file.replace(".zip", "") + '/' + file.replace(".zip", ".img") <- my old code
        path = file.replace(".zip", "") + '/' + os.path.basename(file).replace(".zip", ".img") #Thanks to Lewis Boon
-       extractCMD = 'unzip ' + file
+       #extractCMD = 'unzip ' + file
+       extractCMD = 'unzip -j -d '+ file.replace(".zip", " ") + file
 
    if archiveType == 'img': 
        path =  file;

@@ -272,10 +272,10 @@
        SDsnip = "/dev/mmcblk" + SD[11]
    else:
        if OS[0] != 'Darwin': 
-           SDsnip =  SD.replace(' ', '')[:-1]
+           SDsnip =  SD.replace(' ', '')[:-1]
        else:
            # remove weird partition notation in OS X partition names
-           SDsnip =  SD.replace(' ', '')[:-2]
+           SDsnip =  SD.replace(' ', '')[:-2]
 
    print path
    print '\n\n###################################################################'

Problem for Download choice 1

This are the trace after the choice 1

our Choice e.g: '1' : 1
Traceback (most recent call last):
File "./raspiwrite.py", line 438, in
driveTest(SD) #action gets delegated to driveTest, which then leads on to the next step, I found this to be the easiest way
File "./raspiwrite.py", line 376, in driveTest
driveTest(manualID)
File "./raspiwrite.py", line 372, in driveTest
getImage(SD)
File "./raspiwrite.py", line 320, in getImage
URL = choice(getZipUrl(grabRoot('debian')))
File "./raspiwrite.py", line 101, in getZipUrl
htmlSource = urllib2.urlopen(url).read()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 383, in open
req.timeout = timeout
AttributeError: 'NoneType' object has no attribute 'timeout'

Tries to write wrong file on OSX.

Hi, this script needs work! On OSX it tries to run this:

Running dd bs=1m if=2012-09-18-wheezy-raspbian/2012-09-18-wheezy-raspbian.img of=/dev/disk1...
Waitingdd: 2012-09-18-wheezy-raspbian/2012-09-18-wheezy-raspbian.img: No such file or directory

It can't find the file because ...raspbian.img is unzipped into the same level as ...raspbian.zip, not into a subdirectory. This may be something OSX does weird or maybe raspbian have changed the layout of their zip. In any case you should list the contents of the zip file and look for the largest .img file in it, then use that.

Indentation Error

File "./raspiwrite.py", line 177
else:
^
IndentationError: unindent does not match any outer indentation level

Partition/drive detection broken for BootCamp Windows partitions

---------------------------------------------------------
The following drives were found, please verify the name of the SD card in finder with the name under the 'Mounted On' column (after '/volumes/'):

Filesystem      Size   Used  Avail Capacity  Mounted on
Volumes/Windows 7
/dev/disk1s3   6.3Gi  6.2Gi   81Mi    99%    /Volumes/Mac OS X Install DVD
/dev/disk2s1    30Gi  2.1Mi   30Gi     1%    /Volumes/NO NAME
---------------------------------------------------------

I believe this is your SD card: /Windows is that correct? (Y/n) n

So the issues are:
(1) The BootCamp partition is auto-detected as the SD card;
(2) The name is then truncated from "/Volumes/Windows 7" to "/Windows"

'df -h' (which doesn't include unmounted volumes - the output below is with the SD card inserted) returns:

Filesystem      Size   Used  Avail Capacity  Mounted on
/dev/disk0s2   400Gi  321Gi   79Gi    81%    /
devfs          190Ki  190Ki    0Bi   100%    /dev
map -hosts       0Bi    0Bi    0Bi   100%    /net
map auto_home    0Bi    0Bi    0Bi   100%    /home
/dev/disk0s4    65Gi   31Gi   34Gi    48%    /Volumes/Windows 7
/dev/disk1s3   6.3Gi  6.2Gi   81Mi    99%    /Volumes/Mac OS X Install DVD

... but wouldn't using 'diskutil list' be better?:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.1 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            429.9 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
   4:       Microsoft Basic Data Windows 7               69.3 GB    disk0s4
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *7.8 GB     disk1
   1:        Apple_partition_map                         30.7 KB    disk1s1
   2:         Apple_Driver_ATAPI                         1.0 GB     disk1s2
   3:                  Apple_HFS Mac OS X Install DVD    6.7 GB     disk1s3
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *32.0 GB    disk2
   1:             Windows_FAT_32 NO NAME                 32.0 GB    disk2s1

... where '/dev/disk2' can still be identified as the correct target volume.

Code is riddled with syntax errors

Sorry to say kind of sloppy...

new-host:~ patricklemiuex$ python rabserri_img.py
File "rabserri_img.py", line 177
else
^
SyntaxError: invalid syntax
new-host:~ patricklemiuex$ python rabserri_img.py
File "rabserri_img.py", line 275
SDsnip = SD.replace(' ', '')[:-1]
^

Update raspiwrite.py

Syntax issues with script on lines 177 and 275.

line 177:
else

to

else:

line 275:
Needs an additional tab before:
SDsnip = SD.replace(' ', '')[:-1]

Write fails if image has previously been manually unzipped

Do you wish to Download a Raspberry Pi compatible image (choose yes if you don't have one) (Y/n): n
Please locate the disk image (.zip, .img.gz, .tar.bz2 (.tar.bz2 only working with QtonPi distros currently): /Users/Stuart/Downloads/debian6-19-04-2012.zip
Found Zip
Found archive inputted by user, extracting...
archive already has been extracted, skipping unzipping...
/Users/Stuart/Downloads/debian6-19-04-2012/debian6-19-04-2012.img

...

Please verify this information before typing 'accept' to accept the terms and to start the process, if this information isn't correct, please press ctrl + c (^C), or type 'exit' to quit: acccept
ENDING WITHOUT COPYING ANY DATA ACROSS, SD CARD HAS BEEN UNMOUNTED

Syntax error

I'm getting the following error on my rMBP with mountain lion ...

File "./raspiwrite.py", line 177
else
^
SyntaxError: invalid syntax

Syntax error in script

curl https://raw.githubusercontent.com/exaviorn/RasPiWrite/master/raspiwrite.py | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 19000  100 19000    0     0   7354      0  0:00:02  0:00:02 --:--:--  7352
  File "<stdin>", line 177
    else
       ^
SyntaxError: invalid syntax

I tried fixing it but I'm not a Pythonista. I added (what I took to be) the missing : but then there was some indentation error that didn't make any sense to me.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.