Seite 1 von 1

PythonCard Fehler

Verfasst: Donnerstag 27. Oktober 2011, 08:11
von Neo_Junior
Hi erstmal,

ich habe einen neuen pc (sehr gute hardware aber nur windows xp 32 bit) mit python und modulen rüberziehen und neuinstallieren hat alles gut geklappt (altert pc: schlechte hardware, xp 32bit)
jetzt wollte ich mal wieder ein bisschen mit PythonCard basteln und schwupp gehen programme, die früher 100% liefen nicht mehr und es zeigt mir diese fehlermeldung nicht in meinem skript sondern in util.py (also was von pycard) an:

*das was in meinem skript dadurch nich stimmt wird auch gezeigt*


f = open(filename)
TypeError: coercing to Unicode: need string or buffer, NoneType found
Script terminated.

und das ist in zeile 39 in util.py.....

so das wars ich weis nicht warum ich habe z.B. ein anderes programm mit pycard aber das ist eigentlich ein test und funktioniert noch nicht (es passiert noch nichts KEINE fehlermeldung) und das "geht" immernoch

über hilfe wäre ich echt sehr dankbar ich stelle nochma beide skripte von dem was immer ging rein (lehrbuch).

Code: Alles auswählen

# -*- coding: iso-8859-1 -*-
# Listing-20-5.py
# Copyright Warren Sande, 2009
# Released under MIT license   http://www.opensource.org/licenses/mit-license.php
# Version 61  ----------------------------

# Noch mehr Aufräumarbeiten

from PythonCard import model

class HauptFenster(model.Background):

    def on_cmdCinF_command(self, event):
        Cel = float(self.components.tfCel.text)
        Fahr = Cel * 9.0 / 5 + 32
        print'cel = ', Cel, '  fahr = ', Fahr
        self.components.spinFahr.value = int(Fahr)
        
    def on_cmdFinC_command(self, event):
        Fahr = self.components.spinFahr.value
        Cel = (Fahr - 32) * 5.0 / 9
        Cel = '%.2f' % Cel
        self.components.tfCel.text = Cel

app = model.Application(HauptFenster)
app.MainLoop()

 
und dazu die rsrc:

Code: Alles auswählen

{'application':{'type':'Application',
          'name':'Template',
    'backgrounds': [
    {'type':'Background',
          'name':'bgTemplate',
          'title':'Standard Template with File->Exit menu',
          'size':(488, 314),
          'style':['resizeable'],

        'menubar': {'type':'MenuBar',
         'menus': [
             {'type':'Menu',
             'name':'menuFile',
             'label':'&File',
             'items': [
                  {'type':'MenuItem',
                   'name':'menuFileExit',
                   'label':'E&xit',
                   'command':'exit',
                  },
              ]
             },
             {'type':'Menu',
             'name':'menuKonvertieren',
             'label':u'&Konvertieren',
             'items': [
                  {'type':'MenuItem',
                   'name':'menuKonvertierenCinF',
                   'label':u'&Celsius in Fahrenheit',
                   'command':'cmdCinF',
                  },
                  {'type':'MenuItem',
                   'name':'menuKonvertierenFinC',
                   'label':u'&Fahrenheit in Celsius',
                   'command':'cmdFinC',
                  },
              ]
             },
         ]
     },
         'components': [

{'type':'StaticText', 
    'name':'StaticText2', 
    'position':(319, 119), 
    'text':u'Fahrenheit', 
    },

{'type':'StaticText', 
    'name':'StaticText1', 
    'position':(88, 119), 
    'text':u'Celsius', 
    },

{'type':'Spinner', 
    'name':'spinFahr', 
    'position':(291, 77), 
    'max':100, 
    'min':0, 
    'value':0, 
    },

{'type':'TextField', 
    'name':'tfCel', 
    'position':(52, 78), 
    },

{'type':'Button', 
    'name':'btnFinC', 
    'position':(163, 112), 
    'command':u'cmdFinC', 
    'label':u'Fahrenheit in Celsius', 
    },

{'type':'Button', 
    'name':'btnCinF', 
    'position':(161, 77), 
    'command':u'cmdCinF', 
    'label':u'Celsius in Fahrenheit', 
    },

] # end components
} # end background
] # end backgrounds
} }

Danke schonma :D

Re: PythonCard Fehler

Verfasst: Donnerstag 27. Oktober 2011, 08:25
von BlackJack
@Neo_Junior: Ein kompletter Backtrace wäre vielleicht hilfreich.

Re: PythonCard Fehler

Verfasst: Donnerstag 27. Oktober 2011, 08:37
von Neo_Junior
ich schäm`mich grade ganz doll....die rsrc dateien waren nich im selbn ordner :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops: :oops:

damit hat sich das geklärt....