简体   繁体   English

Python 2.5.6和2.4.3

[英]Python 2.5.6 vs 2.4.3

I created a python script with Python 2.5.6 (Windows), tested it and it worked correctly. 我使用Python 2.5.6(Windows)创建了一个python脚本,对其进行了测试并正常运行。 After I put it on the Server (python 2.4.3, Linux) it compiled, but didn't work. 在将其放入服务器(Python 2.4.3,Linux)后,它进行了编译,但是没有起作用。 It didn't gave me any traceback or whatsoever. 它没有给我任何追溯或任何回溯。 Since it is a trac system it called the Script but then Timed out. 由于它是跟踪系统,因此调用了脚本,但随后超时。

I narrowed the cause down to a few functions, which only appear in the new file: 我将原因缩小为几个函数,这些函数仅出现在新文件中:

cursor.fetchall()

or 要么

for x in y
   if(x == 1):
      break #does this work?

or 要么

FILE operations

Is there a common thing I have overseen or does somebody know what it could be? 我监督过什么常事,还是有人知道这可能是什么?

Due to restrictions I am not able to use python 2.4 as dev. 由于限制,我无法将python 2.4用作开发人员。 I need to work with Trac Standalone which only works with python 2.5.x. 我需要使用仅适用于python 2.5.x的Trac Standalone。

See What's new in Python 2.5 for the definitive list of features that have been added in Python 2.5. 有关Python 2.5中添加的功能的确定列表,请参见Python 2.5中的新增功能。 It's pretty extensive. 非常广泛。 In particular: 尤其是:

New modules include ... the SQLite database module ( sqlite ) 新模块包括... SQLite数据库模块( sqlite

Generally, the 2.x series of releases maintain backwards compatibility. 通常,2.x系列发行版保持向后兼容性。 However, you seem to be expecting forward compatibility, which is a different thing. 但是,您似乎期望向前兼容,这是另一回事。

My advice is twofold: 我的建议是双重的:

  1. Python 2.4 is very old. Python 2.4很老了。 If you can, get the server upgraded to a more recent version of Python. 如果可以,请将服务器升级到最新版本的Python。
  2. Regardless of the outcome of the #1, get the dev box onto the same version of Python that you're going to use in production. 不管#1的结果如何,都将dev框放到要在生产中使用的相同版本的Python。 It would also help if the dev box used the same OS as the prod box (in a virtual machine, if need be). 如果dev框使用与prod框相同的操作系统(如果需要,则在虚拟机中)也将有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM