# Weird python behavior -- FreeBSD related?



## ppvora (Apr 24, 2013)

Hello all,

I'm running FreeBSD 8.2-RELEASE. I am attempting to do some really simple things in Python (python27-2.7.3_6) which results in weird behavior. I'm reaching out to the FreeBSD forums instead of Python groups because I think this may be a FreeBSD related issue. For example:

```
[ppvora@snowfall ~/xbrl]$ python 
Python 2.7.3 (default, Apr 22 2013, 18:42:18) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.
>>> import glob
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "glob.py", line 14, in <module>
    myl = glob.glob('data/*.xml')
TypeError: 'module' object is not callable
```

The error above refers to a Python program glob.py that I had run in a different screen session. The program itself doesn't appear to have any errors, but throws that TypeError. (This is also a mystery). But why would something that threw an error under a different screen session screw up something in another session? 

Any help is highly appreciated.
-Premal


----------



## volatilevoid (Apr 25, 2013)

This is because your script has the same name as the Python glob library which you're obviously importing in glob.py via `import glob`. I tried out the one line from your script which is displayed as traceback. Renamed glob.py to glob2.py, removed glob2.pyc and retried the script `import` -> works.

And I tried it on a non-FreeBSD machine, so it's not FreeBSD related. 

HTH,
Thomas


----------



## ppvora (Apr 26, 2013)

Thanks Thomas -- that's helpful. Yes, the problem is fixed!


----------

