NameError: global name 'os' is not defined

1,030 views
Skip to first unread message

Jordan

unread,
Apr 19, 2012, 4:28:23 PM4/19/12
to trac-...@googlegroups.com
I am running Trac 0.12 with the mod_python installation.  When trying to test the installation of the TracWikiToPDF Plugin, when I attempt to create the PDF, I come across this error:

ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 513, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/trac/web/main.py", line 235, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/trac/admin/web_ui.py", line 121, in process_request
    path_info)
  File "build/bdist.linux-i686/egg/wikitopdf/web_ui.py", line 79, in process_admin_request
  File "build/bdist.linux-i686/egg/wikitopdf/formats.py", line 26, in process_wikitopdf
NameError: global name 'os' is not defined

I am by no means an expert with Trac installations or Python so any help would be greatly appreciated.

Thanks,
Jordan


Benjamin Lau

unread,
Apr 19, 2012, 8:54:07 PM4/19/12
to trac-...@googlegroups.com
I think rjollos may have gone a bit overboard with cleaning up the
import statements in this plugin...

If you add a line:
import os

to the formats.py file in the plugin sources... that should fix the
problem. I don't know how you installed the plugin... but you'll need
to grab the latest sources from svn, build it and install it again.

svn co http://trac-hacks.org/svn/tracwikitopdfplugin/0.11/ tracwikitopdfplugin
cd tracwikitopdfplugin
python setup.py install
or
python setup.py bdist_egg (the egg will be in the dist directory and
can be copied to you trac environment's plugins directory.

I'll hope that your python is the same one as your one for trac (2.4
based on your logs).

If you run into trouble feel free to pop over to #trac on irc.freenode.net

Ben

> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/trac-users/-/csTA17_ApbYJ.
> To post to this group, send email to trac-...@googlegroups.com.
> To unsubscribe from this group, send email to
> trac-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/trac-users?hl=en.

Padams, Jordan (388K)

unread,
Apr 19, 2012, 7:27:10 PM4/19/12
to trac-...@googlegroups.com
I actually just got this resolved by the maintainer of the plugin.  Apparently this was a bug.

- Jordan

RjOllos

unread,
Apr 20, 2012, 4:50:53 PM4/20/12
to Trac Users
Stupid error on my part. The fear of such as sloppy error advertised
on the mailing list will lead me to be more careful next time ;)
Reply all
Reply to author
Forward
0 new messages