zoukankan      html  css  js  c++  java
  • python 提示 :OverflowError: Python int too large to convert to C long

    一次在使用orm进行联表查询的时候,出现   Python int too large to convert to C long 的问题:

    在分析错误之后,在错误最后面提示中有:

      File "F:pythonpython3.6libsqlite3dbapi2.py", line 64, in convert_date
        return datetime.date(*map(int, val.split(b"-")))

    在查看我的model.py文件的时候我的模型定义是:

    from django.db import models
    
    
    # Create your models here.
    
    class Book(models.Model):
        nid = models.AutoField(primary_key=True)
        title = models.CharField(max_length=64)
        publishDate = models.DateField()
        price = models.DecimalField(max_digits=5, decimal_places=2)
    
        publish = models.ForeignKey(to="Publish", to_field="nid", on_delete=models.CASCADE)
    
        authors = models.ManyToManyField(to="Author")
    
    
    class Author(models.Model):
        nid = models.AutoField(primary_key=True)
        name = models.CharField(max_length=32)
        age = models.IntegerField()
        # 作者和作者信息一对一
        AuthorDetail=models.OneToOneField(to="AuthorDetail",on_delete=models.CASCADE)
    
    
    class AuthorDetail(models.Model):
        nid = models.AutoField(primary_key=True)
        # birthday = models.DateField()  # 特别是这一行进行注视后,就不会再提示 Python int too large to convert to C long  了
      # 或则将此行改为
      birthday = models.DateTimeField()
       tetephone = models.BigIntegerField()
        addr = models.CharField(max_length=64)
    
    
    class Publish(models.Model):
        nid = models.AutoField(primary_key=True)
        name = models.CharField(max_length=32)
        city = models.CharField(max_length=32)
        email = models.EmailField()
  • 相关阅读:
    poj2096(概率dp)
    bzoj4318/洛谷P1654OSU!(期望dp,立方版本)
    hdu1027(逆康托展开)
    hdu3734(数位dp,相减抵消影响)
    hdu2089(数位dp模版)
    hdu2856(倍增lca模版题)
    COI2007 Patrik 音乐会的等待 洛谷P1823
    校门外的树2 contest 树状数组练习 T4
    数星星 contest 树状数组练习 T2
    A simple problem with integer 树状数组区间查询模板题 contest 树状数组练习 T1
  • 原文地址:https://www.cnblogs.com/one-tom/p/12051545.html
Copyright © 2011-2022 走看看