2010-12-03 8 views
-1

Cette fonction déclenche une exception, peu importe ce que je change:Pourquoi mon script Python ne fonctionne-t-il pas?

def some_func(name=None): 
    if name isn't None: 
     print(name) 

Ensuite, j'essaie de l'exécuter:

some_func('Tom') 

Il soulève cette exception:

Sorry, there was an error in processing this form action "some_func". Please report the error or try again later. 
(Error calling SOAP method: Error deserializing message: Can't locate ShipRequest/FedEx/SOAP/Elements /FuelSurchargePercent.pm in @INC 
(@INC contains: /usr/lib/interchange 
    /var/lib/transactions/lib2 
    /usr 
    /lib/interchange/lib 
    /usr/local/lib/perl5/5.8.8/i686-linux 
    /usr/local/lib/perl5/5.8.8 
    /usr/local/lib 
    /perl5/site_perl/5.8.8/i686-linux 
    /usr/local/lib/perl5/site_perl/5.8.8 
    /usr/local/lib/perl5/site_perl 
.) at (eval 3213) line 3. 
at line 2 at /usr/local/lib/perl5/site_perl/5.8.8/SOAP/WSDL/Expat/Base.pm line 18 . 
[scalac] Compiling 3 scala and 196 java source files to /home/alain/Documents/Project/build/model/src 
[scalac] error: error while loading Error, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by /home/alain/Documents/Project/model/dist/model.jar(model/error/Error.class) 
[scalac] error: error while loading Binder, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by /home/alain/Documents/Project/model/dist/model.jar(model/attachment/Binder.class) 
[scalac] error: error while loading Journal, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by /home/alain/Documents/Project/model/dist/model.jar(model/note/Journal.class) 
[scalac] error: error while loading Exemption, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by /home/alain/Documents/Project/model/dist/model.jar(model/exemption/Exemption.class) 
[scalac] error: error while loading Flag, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by /home/alain/Documents/Project/model/dist/model.jar(model/flag/Flag.class) 
    <error-page> 
    <error-code>500</error-code> 
    <location>/WEB-INF/pages/500.jsp</location> 
    </error-page> 
[scalac] error: error while loading ConfigurationGroup, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by /home/alain/Documents/Project/model/dist/model.jar(model/configuration/ConfigurationGroup.class) 
[scalac] error: error while loading IssueConfiguration, Missing dependency 'class javax.jdo.spi.PersistenceCapable$ObjectIdFieldSupplier', required by /home/alain/Documents/Project/model/dist/model.jar(model/analysis/configuration/IssueConfiguration.class) 
[scalac] 7 errors found 
1>GameEngine.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" ([email protected]@@2NA) 
1>Component.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" ([email protected]@@2NA) 
1>Coordinate.obj : error LNK2019: unresolved external symbol "public: static double WeaponsDB::PI" ([email protected]@@2NA) referenced in function "public: double __thiscall Coordinate::distanceFrom(class Coordinate *)" ([email protected]@@[email protected]@Z) 
1>Driver.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" ([email protected]@@2NA) 
1>Environment.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" ([email protected]@@2NA) 
1>Environment.obj : error LNK2001: unresolved external symbol "public: static bool Environment::spyFlag" ([email protected]@@2_NA) 
1>Environment.obj : error LNK2001: unresolved external symbol "private: static class Environment * Environment::instance_" ([email protected]@@[email protected]) 
1>Environment.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Environment::spyAlertOver(void)" ([email protected]@@SAXXZ) referenced in function "public: void __thiscall Environment::notificationOfSpySuccess(void)" ([email protected]@@QAEXXZ) 
1>GameDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl MainMenu::gameOver(int)" ([email protected]@@[email protected]) referenced in function "public: static void __cdecl GameDriver::run(void)" ([email protected]@@SAXXZ) 
1>GameDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl GameDriver::gatherInput(void)" ([email protected]@@SAXXZ) referenced in function "public: static void __cdecl GameDriver::run(void)" ([email protected]@@SAXXZ) 
1>GameDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl GameDriver::ticker(void)" ([email protected]@@SAXXZ) referenced in function "public: static void __cdecl GameDriver::run(void)" ([email protected]@@SAXXZ) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static int GameDriver::ticks" ([email protected]@@2HA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::evaluatingInputFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyQuitFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyToggleWeaponRightFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyToggleWeaponLeftFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyFireFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyLeftFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyRightFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyUpFlag" ([email protected]@@2_NA) 
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyDownFlag" ([email protected]@@2_NA) 
1>GUI_Env.obj : error LNK2001: unresolved external symbol "private: static struct BITMAP * GUI_Env::buffer" ([email protected][email protected]@[email protected]@A) 
1>GUI_Info.obj : error LNK2001: unresolved external symbol "private: static struct BITMAP * GUI_Info::buffer" ([email protected][email protected]@[email protected]@A) 
1>MenuDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl MainMenu::displayMenu(void)" ([email protected]@@SAXXZ) referenced in function "public: static void __cdecl MenuDriver::start(void)" ([email protected]@@SAXXZ) 
1>SpaceObjectFactory.obj : error LNK2001: unresolved external symbol "private: static class SpaceObjectFactory * SpaceObjectFactory::_instance" ([email protected]@@[email protected]) 
1>Spy.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall UnFormationable::sameTypeOfSpaceObjectAs(class SpaceObject *)" ([email protected]@@[email protected]@@Z) referenced in function "public: virtual bool __thiscall Spy::sameTypeOfSpaceObjectAs(class SpaceObject *)" ([email protected]@@[email protected]@@Z) 
1>WeaponsDB.obj : error LNK2001: unresolved external symbol "private: static class WeaponsDB * WeaponsDB::_instance" ([email protected]@@[email protected]) 
1>C:\Users\Owner\Desktop\Bosconian\code\Bosconian\Debug\Bosconian.exe : fatal error LNK1120: 23 unresolved externals 

Répondre

1

isn't n'est pas un mot-clé. Il devrait être is not.

+0

pourquoi ne mentionnent pas les erreurs? –

+1

@Johnny 5: C'est le cas. La première ligne de l'erreur dit de façon énigmatique qu'il ne peut pas analyser votre some_func. C'est parce qu'il y a des citations déséquilibrées. Ce serait bien si cela donnait une erreur plus courte cependant. –

+0

@Johnny 5: en règle générale, '' ne sera ___ jamais utilisé dans un identifiant dans un langage de programmation. Cela a toujours quelque chose à voir avec la citation de symboles pour éviter qu'ils soient évalués. – aaronasterling

2

utilisation

is not None 

au lieu de

isn't None 
+0

oui, mais regardez les erreurs. Il ne dit même pas que –

+1

@Johnny 5: Parce qu'aucun de ces rapports est à propos de python. – Kabie

Questions connexes