#41 error line 1274

open
nobody
None
5
2010-01-17
2010-01-17
Anonymous
No

$ start_proximity.sh
Traceback (most recent call last):
File "proximity.py", line 1274, in <module>
config = ConfigObj(os.path.join(conf_dir, _('standard') + '.conf'),{'create_empty':True,'configspec':conf_specs})
File "/usr/lib/python2.6/site-packages/configobj.py", line 1206, in __init__
DeprecationWarning, stacklevel=2)
TypeError: warn() takes at most 3 arguments (4 given)

installed:
extra/bluez 4.59-1
Libraries and tools for the Bluetooth protocol stack
local/bluez-python 0.1.4-1
A BlueZ python binding on top of dbus-python
community/python-pybluez 0.18-1
Python wrapper for the BlueZ Bluetooth stack
extra/python 2.6.4-1
A high-level scripting language

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2010-01-18

    Error after update of python-configobj to version 4.7.0-1:

    File "proximity.py", line 1274, in <module>
    config = ConfigObj(os.path.join(conf_dir, _('standard') + '.conf'),{'create_empty':True,'file_error':False,'configspec':conf_specs})
    File "/usr/lib/python2.6/site-packages/configobj.py", line 1206, in __init__
    DeprecationWarning, stacklevel=2)
    TypeError: warn() takes at most 3 arguments (4 given)

    Consulting the configobj-specifications:

    http://www.voidspace.org.uk/python/configobj.html#configobj-specifications

    results in an easy fix:

    --- proximity.py 2008-02-28 16:59:01.000000000 +0100
    +++ /usr/bin/proximity.py 2010-01-18 22:54:51.346179032 +0100

    @@ -111,3 +111,3 @@
    pass
    -if (IMPORT_BT!=2):
    +if (IMPORT_BT!=3):
    print _("The program cannot import the module bluetooth.")
    @@ -1259,3 +1259,3 @@
    # add every valid .conf file to the array of configs
    - config = ConfigObj(os.path.join(conf_dir,filename),{'create_empty':False,'file_error':True,'configspec':conf_specs})
    + config = ConfigObj(os.path.join(conf_dir,filename),**{'create_empty':False,'file_error':True,'configspec':conf_specs})
    # first validate it
    @@ -1273,3 +1273,3 @@
    if new_config:
    - config = ConfigObj(os.path.join(conf_dir, _('standard') + '.conf'),{'create_empty':True,'file_error':False,'configspec':conf_specs})
    + config = ConfigObj(os.path.join(conf_dir, _('standard') + '.conf'),**{'create_empty':True,'file_error':False,'configspec':conf_specs})
    # next line fixes a problem with creating empty strings in default values for configobj

     
    Last edit: Anonymous 2013-11-26
  • Jeremy Agee

    Jeremy Agee - 2010-06-02

    So I have not tracked this completely down but this may be related to a change in python-configobj. When I upgraded to F13 this broke for me. I was using python-configobj-4.6.0-2.fc12.noarch but and now using the newer python-configobj-4.7.0-2.fc13.noarch library.

    http://www.voidspace.org.uk/python/configobj.html

    "New in ConfigObj 4.7.0: Instantiating ConfigObj with an options dictionary is now deprecated. To modify code that used to do this simply unpack the dictionary in the constructor call:
    config = ConfigObj(filename, **options)"

    I was able to get it working again by changing the following in proximity.py

    line 1260
    config = ConfigObj(os.path.join(conf_dir,filename),{'create_empty':False,'file_error':True,'configspec':conf_specs})

    changed to
    config = ConfigObj(infile=os.path.join(conf_dir,filename),create_empty=True,file_error=False,configspec=conf_specs)

    line 1274
    config = ConfigObj(os.path.join(conf_dir, _('standard') + '.conf'),{'create_empty':True,'file_error':False,'configspec':conf_specs})

    change to
    config = ConfigObj(infile=os.path.join(conf_dir, _('standard') + '.conf'),create_empty=True,file_error=False,configspec=conf_specs)

    Not sure if this will cause errors on the older python-configobj-4.6.0 code?

     
  • Jeremy Agee

    Jeremy Agee - 2010-06-02

    So I went back and checked about python-configobj-4.6.0 and my previous comment does work for this version too. I also tested adding the ** as the deprecated message referred to and this also works for both versions. The real question now is should the call be changed to the new format or should the deprecated method be used.

    line 1260
    config = ConfigObj(os.path.join(conf_dir,filename),**{'create_empty':False,'file_error':True,'configspec':conf_specs})
    Or
    config = ConfigObj(infile=os.path.join(conf_dir,filename),create_empty=True,file_error=False,configspec=conf_specs)

    line 1274
    config = ConfigObj(os.path.join(conf_dir, _('standard') + '.conf'),**{'create_empty':True,'file_error':False,'configspec':conf_specs})
    or
    config = ConfigObj(infile=os.path.join(conf_dir, _('standard') + '.conf'),create_empty=True,file_error=False,configspec=conf_specs)

    Also these two lines are for loading a new config file or and existing one. So depending if you have a config file exists or not, you get a error on line 1260 or 1274. The line 1274 is the new file load.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks