为什么我的Python脚本不起作用?

时间:2010-12-03 03:44:52

标签: python exception

无论我改变什么,此函数都会引发异常:

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

然后我尝试运行它:

some_func('Tom')

它引发了这个例外:

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" (?PI@WeaponsDB@@2NA)
1>Component.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA)
1>Coordinate.obj : error LNK2019: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA) referenced in function "public: double __thiscall Coordinate::distanceFrom(class Coordinate *)" (?distanceFrom@Coordinate@@QAENPAV1@@Z)
1>Driver.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA)
1>Environment.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA)
1>Environment.obj : error LNK2001: unresolved external symbol "public: static bool Environment::spyFlag" (?spyFlag@Environment@@2_NA)
1>Environment.obj : error LNK2001: unresolved external symbol "private: static class Environment * Environment::instance_" (?instance_@Environment@@0PAV1@A)
1>Environment.obj : error LNK2019: unresolved external symbol "public: static void __cdecl Environment::spyAlertOver(void)" (?spyAlertOver@Environment@@SAXXZ) referenced in function "public: void __thiscall Environment::notificationOfSpySuccess(void)" (?notificationOfSpySuccess@Environment@@QAEXXZ)
1>GameDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl MainMenu::gameOver(int)" (?gameOver@MainMenu@@SAXH@Z) referenced in function "public: static void __cdecl GameDriver::run(void)" (?run@GameDriver@@SAXXZ)
1>GameDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl GameDriver::gatherInput(void)" (?gatherInput@GameDriver@@SAXXZ) referenced in function "public: static void __cdecl GameDriver::run(void)" (?run@GameDriver@@SAXXZ)
1>GameDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl GameDriver::ticker(void)" (?ticker@GameDriver@@SAXXZ) referenced in function "public: static void __cdecl GameDriver::run(void)" (?run@GameDriver@@SAXXZ)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static int GameDriver::ticks" (?ticks@GameDriver@@2HA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::evaluatingInputFlag" (?evaluatingInputFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyQuitFlag" (?keyQuitFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyToggleWeaponRightFlag" (?keyToggleWeaponRightFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyToggleWeaponLeftFlag" (?keyToggleWeaponLeftFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyFireFlag" (?keyFireFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyLeftFlag" (?keyLeftFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyRightFlag" (?keyRightFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyUpFlag" (?keyUpFlag@GameDriver@@2_NA)
1>GameDriver.obj : error LNK2001: unresolved external symbol "public: static bool GameDriver::keyDownFlag" (?keyDownFlag@GameDriver@@2_NA)
1>GUI_Env.obj : error LNK2001: unresolved external symbol "private: static struct BITMAP * GUI_Env::buffer" (?buffer@GUI_Env@@0PAUBITMAP@@A)
1>GUI_Info.obj : error LNK2001: unresolved external symbol "private: static struct BITMAP * GUI_Info::buffer" (?buffer@GUI_Info@@0PAUBITMAP@@A)
1>MenuDriver.obj : error LNK2019: unresolved external symbol "public: static void __cdecl MainMenu::displayMenu(void)" (?displayMenu@MainMenu@@SAXXZ) referenced in function "public: static void __cdecl MenuDriver::start(void)" (?start@MenuDriver@@SAXXZ)
1>SpaceObjectFactory.obj : error LNK2001: unresolved external symbol "private: static class SpaceObjectFactory * SpaceObjectFactory::_instance" (?_instance@SpaceObjectFactory@@0PAV1@A)
1>Spy.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall UnFormationable::sameTypeOfSpaceObjectAs(class SpaceObject *)" (?sameTypeOfSpaceObjectAs@UnFormationable@@UAE_NPAVSpaceObject@@@Z) referenced in function "public: virtual bool __thiscall Spy::sameTypeOfSpaceObjectAs(class SpaceObject *)" (?sameTypeOfSpaceObjectAs@Spy@@UAE_NPAVSpaceObject@@@Z)
1>WeaponsDB.obj : error LNK2001: unresolved external symbol "private: static class WeaponsDB * WeaponsDB::_instance" (?_instance@WeaponsDB@@0PAV1@A)
1>C:\Users\Owner\Desktop\Bosconian\code\Bosconian\Debug\Bosconian.exe : fatal error LNK1120: 23 unresolved externals

2 个答案:

答案 0 :(得分:2)

使用

is not None

而不是

isn't None

答案 1 :(得分:1)

isn't不是关键字。它应该是is not