Git Product home page Git Product logo

python-var-dump's Issues

Output to string?

This is great. An enhancement would be to also be able to output to a string. There are times where printing isn't available but logger.debug() is available.

Is this abandonware?

Hey,

I wanna use + improve this lib.

But It looks like it is abandoned / not maintained anymore… Is it? Does it make sense to make a PR?

does a bad job with ctypes.wintypes.ULARGE_INTEGER

no matter what the ULARGE_INTEGER actually contains, it will just var_dump as

object(c_ulonglong) (0)

for example

import ctypes
import ctypes.wintypes
from var_dump import var_dump

foo = ctypes.wintypes.ULARGE_INTEGER(123)
var_dump(foo, foo.value)

prints

#0 object(c_ulonglong) (0)
#1 int(123)

interestingly print() gets it right,

print(ctypes.wintypes.ULARGE_INTEGER(123))

gives

c_ulonglong(123)

AttributeError: 'thread.lock' object has no attribute '__dict__'

Facing this issue on dumping an object. Please check.

Traceback (most recent call last):
  File "C:/Python27/test_dump.py", line 7, in <module>
    var_dump(r)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 79, in var_dump
    dump(x, 0, i, '', object)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 66, in dump
    dump(o[i], space, num, i, typ)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 66, in dump
    dump(o[i], space, num, i, typ)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 66, in dump
    dump(o[i], space, num, i, typ)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 56, in dump
    display(o, space, num, key, typ)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 45, in display
    l.append(len(o.__dict__))
AttributeError: 'thread.lock' object has no attribute '__dict__' 

How to reproduce? Please try this code.

import requests
from var_dump import var_dump
r = requests.get('https://api.github.com/events')
var_dump(r)

Problems trying to run in Python 3.32

I get this error when i try to run it

Traceback (most recent call last):
    File "D:\Project\Tyme Agent Py\src\main.py", line 4, in <module>
        from var_dump import var_dump
    File "D:\Python\lib\site-packages\var_dump\__init__.py", line 2, in <module>
        from _var_dump import var_dump
ImportError: No module named '_var_dump'

ttributeError: 'weakref' object has no attribute '__dict__'

(FlaskEnv)[bud@dev tests]$ nosetests -s test_models.py
#0 list(2)

[0] => object(User) (14)
    openid => NoneType(None) 
    activation_key => NoneType(None) 
    _sa_instance_state => object(InstanceState) (12)

E

ERROR: test_get_current_time (tests.test_models.TestUser)

Traceback (most recent call last):
File "/home/bud/py/fbone/tests/test_models.py", line 12, in test_get_current_time
var_dump(User.query.all())
File "/home/bud/.pyenv/versions/FlaskEnv/lib/python2.7/site-packages/var_dump/_var_dump.py", line 79, in var_dump
dump(x, 0, i, '', object)
File "/home/bud/.pyenv/versions/FlaskEnv/lib/python2.7/site-packages/var_dump/_var_dump.py", line 68, in dump
dump(i, space, num, '', typ)
File "/home/bud/.pyenv/versions/FlaskEnv/lib/python2.7/site-packages/var_dump/_var_dump.py", line 66, in dump
dump(o[i], space, num, i, typ)
File "/home/bud/.pyenv/versions/FlaskEnv/lib/python2.7/site-packages/var_dump/_var_dump.py", line 66, in dump
dump(o[i], space, num, i, typ)
File "/home/bud/.pyenv/versions/FlaskEnv/lib/python2.7/site-packages/var_dump/_var_dump.py", line 56, in dump
display(o, space, num, key, typ)
File "/home/bud/.pyenv/versions/FlaskEnv/lib/python2.7/site-packages/var_dump/_var_dump.py", line 45, in display
l.append(len(o.dict))
AttributeError: 'weakref' object has no attribute 'dict'


Ran 1 test in 0.063s

FAILED (errors=1)

Fails on sets - 'set' object has no attribute '__dict__'

x = set([1,2,3])
from var_dump import var_dump
var_dump(x)
Traceback (most recent call last):
  File "dumpset.py", line 3, in <module>
    var_dump(x)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 79, in var_dump
    dump(x, 0, i, '', object)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 56, in dump
    display(o, space, num, key, typ)
  File "C:\Python27\lib\site-packages\var_dump\_var_dump.py", line 45, in display
    l.append(len(o.__dict__))
AttributeError: 'set' object has no attribute '__dict__'

Publish a new version?

$PYTHONEXE -m pip install var_dump --upgrade
$PYTHONEXE -m pip install var_dump --force-reinstall

I'm trying to upgrade, but I'm still getting the implementation from before the recursion fix.

I guess a new version needs to be published.

var_dump('\x9F'); crash on Windows on stdout-to-file redirection

when stdout is redirected to a file,

from var_dump import var_dump
var_dump('\x9F');

will crash on Windows. Not sure why, and does not happen on Linux. reproducing the issue in cmd:

C:\>Python --version
Python 3.10.4

C:\>type crash.py
from var_dump import var_dump
var_dump('\x9F')
C:\>Python crash.py
#0 str(1) "�"

C:\>Python crash.py > stdoud_to_file.txt
Traceback (most recent call last):
  File "C:\crash.py", line 2, in <module>
    var_dump('\x9F')
  File "C:\Python\Python310\lib\site-packages\var_dump\_var_dump.py", line 109, in var_dump
    dump(x, 0, i, '', object, True)
  File "C:\Python\Python310\lib\site-packages\var_dump\_var_dump.py", line 76, in dump
    r += display(o, space, num, key, typ, proret)
  File "C:\Python\Python310\lib\site-packages\var_dump\_var_dump.py", line 68, in display
    print(st % tuple(l))
  File "C:\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\x9f' in position 11: character maps to <undefined>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.