Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Problem with python and sys.maxint

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
8 posts • Page 1 of 1
Author
Message
Vlurk
n00b
n00b
Posts: 8
Joined: Fri Mar 25, 2005 5:08 pm

Problem with python and sys.maxint

  • Quote

Post by Vlurk » Fri Mar 23, 2007 3:07 am

My operating system is Gentoo Linux (of course :)) with kernel 2.6.19-gentoo-r5. I'm currently using gcc-4.1.1-r3, python-2.5-r1 and twisted-2.5.0

I noticed an error with sys.maxint while using bittorrent 5.0.7 and launchmany-curses: it reports the value "none" on my system, instead of a postive integer. Here's my bittorrent error...

[5.0.7 2007-03-22 22:54:29] STDERR : Unhandled error in Deferred:
[5.0.7 2007-03-22 22:54:29] STDERR : Traceback (most recent call last):
[5.0.7 2007-03-22 22:54:29] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 228, in mainLoop
[5.0.7 2007-03-22 22:54:29] STDERR : self.runUntilCurrent()
[5.0.7 2007-03-22 22:54:29] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 533, in runUntilCurrent
[5.0.7 2007-03-22 22:54:29] STDERR : f(*a, **kw)
[5.0.7 2007-03-22 22:54:29] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 239, in callback
[5.0.7 2007-03-22 22:54:29] STDERR : self._startRunCallbacks(result)
[5.0.7 2007-03-22 22:54:29] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 304, in _startRunCallbacks
[5.0.7 2007-03-22 22:54:29] STDERR : self._runCallbacks()
[5.0.7 2007-03-22 22:54:29] STDERR : --- <exception caught here> ---
[5.0.7 2007-03-22 22:54:29] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 317, in _runCallbacks
[5.0.7 2007-03-22 22:54:29] STDERR : self.result = callback(self.result, *args, **kw)
[5.0.7 2007-03-22 22:54:29] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 459, in callLater
[5.0.7 2007-03-22 22:54:29] STDERR : "%s is not greater than or equal to 0 seconds" % (_seconds,)
[5.0.7 2007-03-22 22:54:29] STDERR : exceptions.AssertionError: None is not greater than or equal to 0 seconds

I localized the assertion that was failing and it was a simple comparison of sys.maxint. Weird. I put the assertion in comments just to see what would happen and I got a different error:

[5.0.7 2007-03-22 23:56:21] STDERR : Unhandled error in Deferred:
[5.0.7 2007-03-22 23:56:21] STDERR : Traceback (most recent call last):
[5.0.7 2007-03-22 23:56:21] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/posixbase.py", line 228, in mainLoop
[5.0.7 2007-03-22 23:56:21] STDERR : self.runUntilCurrent()
[5.0.7 2007-03-22 23:56:21] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 533, in runUntilCurrent
[5.0.7 2007-03-22 23:56:21] STDERR : f(*a, **kw)
[5.0.7 2007-03-22 23:56:21] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 239, in callback
[5.0.7 2007-03-22 23:56:21] STDERR : self._startRunCallbacks(result)
[5.0.7 2007-03-22 23:56:21] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 304, in _startRunCallbacks
[5.0.7 2007-03-22 23:56:21] STDERR : self._runCallbacks()
[5.0.7 2007-03-22 23:56:21] STDERR : --- <exception caught here> ---
[5.0.7 2007-03-22 23:56:21] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 317, in _runCallbacks
[5.0.7 2007-03-22 23:56:21] STDERR : self.result = callback(self.result, *args, **kw)
[5.0.7 2007-03-22 23:56:21] STDERR : File "/usr/lib/python2.5/site-packages/twisted/internet/base.py", line 460, in callLater
[5.0.7 2007-03-22 23:56:21] STDERR : tple = DelayedCall(seconds() + _seconds, _f, args, kw,
[5.0.7 2007-03-22 23:56:21] STDERR : exceptions.TypeError: unsupported operand type(s) for +: 'float' and 'NoneType'

Ok, I can see that sys.maxint is used later and that's why the assertion exists. I would need to make sys.maxint report a correct positive integer but I have no idea how to do that. :(

Anybody here has an idea, a solution for me?

Thank you.
Top
Vlurk
n00b
n00b
Posts: 8
Joined: Fri Mar 25, 2005 5:08 pm

  • Quote

Post by Vlurk » Fri Mar 23, 2007 3:22 am

My problem just got weirder. If I launch python from the command line, import sys and ask for sys.maxint, it returns 2147483647, which is correct.

Anybody knows what's happening? I'm completely lost. I thought that sys.maxint was a constant. Why does it return a different value when running bittorrent?
Top
fikiz
Apprentice
Apprentice
Posts: 282
Joined: Mon Mar 07, 2005 8:12 pm
Location: Italy

  • Quote

Post by fikiz » Fri Mar 23, 2007 8:39 am

sys.maxint should return 2147483647 for 32 bit systems and 9223372036854775807 for 64 bit. I think there are no other choices.

maybe you hit a bug somewhere?
Top
brickhaus
n00b
n00b
Posts: 9
Joined: Tue Feb 17, 2004 12:23 am

Did you get anywhere with this?

  • Quote

Post by brickhaus » Tue Apr 17, 2007 10:54 pm

I am receiving the same error messages. Have you filed a Bugzilla report over this? Any resolution?
Top
Pythonhead
Developer
Developer
User avatar
Posts: 1801
Joined: Mon Dec 16, 2002 6:30 pm
Location: Redondo Beach, Republic of Calif.
Contact:
Contact Pythonhead
Website

  • Quote

Post by Pythonhead » Wed Apr 18, 2007 4:11 am

Vlurk wrote:My problem just got weirder. If I launch python from the command line, import sys and ask for sys.maxint, it returns 2147483647, which is correct.

Anybody knows what's happening? I'm completely lost. I thought that sys.maxint was a constant. Why does it return a different value when running bittorrent?
Your problem has nothing to do with sys.maxint:
def callLater(self, _seconds, _f, *args, **kw):
"""See twisted.internet.interfaces.IReactorTime.callLater.
"""

assert callable(_f), "%s is not callable" % _f
assert sys.maxint >= _seconds >= 0, \
"%s is not greater than or equal to 0 seconds" % (_seconds,)
That's telling you that _seconds is None, not sys.maxint.

I tried a random torrent and it worked for me using the same versions as you (except gcc).
Is this failing on all torrents?

Did you guys remove your ~/.bittorrent after upgrading to this version of BT?
Top
bassvandijk
Guru
Guru
User avatar
Posts: 306
Joined: Fri Sep 13, 2002 9:22 pm
Location: Haps, Netherlands

  • Quote

Post by bassvandijk » Thu May 10, 2007 7:20 am

I get the same exception on my system.

Note however that launchmany-curses still downloads after the exception.

Some info on my system:

net-p2p/bittorrent-5.0.7

# emerge --info
Portage 2.1.2.2 (default-linux/x86/2007.0/server, gcc-4.1.1, glibc-2.5-r2, 2.6.20.7 i686)
=================================================================
System uname: 2.6.20.7 i686 Pentium III (Coppermine)
Gentoo Base System release 1.12.9
Timestamp of tree: Thu, 10 May 2007 00:50:01 +0000
dev-lang/python: 2.4.4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox: 1.2.17
sys-devel/autoconf: 2.13, 2.61
sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils: 2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool: 1.5.22
virtual/os-headers: 2.6.17-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-march=pentium3 -O2 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo "
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="apache2 bash-completion berkdb cli cracklib crypt cups emacs fortran gdbm gpm iconv imap libg++ maildir midi mysql ncurses net nls nptl nptlonly pam pcre perl pop pppd python readline reflection sasl session spl sse ssl symlink tcpd threads unicode x86 xml zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark ati chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mga neomagic nsc nv rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"
Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Top
miraage
n00b
n00b
Posts: 15
Joined: Mon Oct 14, 2002 8:23 pm

  • Quote

Post by miraage » Sun Aug 12, 2007 9:36 pm

I'm seeing the same thing. Not really sure what's going on. Version 4.4 works without problems.
Visit my shameless plug!
Top
miraage
n00b
n00b
Posts: 15
Joined: Mon Oct 14, 2002 8:23 pm

  • Quote

Post by miraage » Mon Aug 13, 2007 12:03 am

I asked about this in #bittorrent on irc.freenode.net and user alus responded with the following patch. He said that it would be fixed in upcoming versions, but in the meantime it might be useful to create a -r1 ebuild containing the following patch.

Code: Select all

--- BitTorrent/launchmanycore.py
+++ BitTorrent/launchmanycore.py
@@ -203,8 +203,8 @@
     def periodic_stats(self):
         df = ThreadedDeferred(wrap_task(self.rawserver.external_add_task),
                               self.stats, daemon = True)
-        df.addCallback( self.rawserver.add_task, self.periodic_stats, self.config['display_interval'],
-                        self.periodic_stats )
+        df.addCallback(lambda r : self.rawserver.add_task(self.config['display_interval'],
+                                                          self.periodic_stats))
 
     def stats(self):
         data = []
Note: I haven't tried this yet. But I trust alus :)
Visit my shameless plug!
Top
Post Reply

8 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic