How to port a Python application to Linux that works fine in Windows
Question: I am having trouble porting a working, Windows Python application to Linux. I
am having some problems, because I did not write the code and am just learning
Python. I am having trouble fixing the issues that it keeps throwing up. So
here is a kind of error that right now I am stuck with

    
    
    Traceback (most recent call last):
    File "alpha_beta", line 237, in <module>
    main()
    File "alpha_beta", line 185, in main
    ABCCmd()
    File "alpha_beta.py", line 74, in ABCCmd
    
    File "C:\softs\Python\Lib\shutil.py", line 80, in copy
    File "C:\softs\Python\Lib\shutil.py", line 47, in copyfile
    IOError: [Errno 13] Permission denied: '/myPath/XFiles.bin.addr_patched
    

Any pointers on how to fix it will be much appreciated

Edit:

1) What I mean by I am stuck is, the traceback of the error goes to
C:\softs\Python\Lib but actually I am currently executing this code in Ubuntu.
Why would the traceback reference to windows library

2) Another thing that bothers me is it says there is an IOError.But when I try
to add permission for the denied one it gives me a chmod: changing permissions
of /myPath/xFiles.bin.addr_patched': Operation not permitted Edit 2:

I had commented out a module because I thought it wasn't very useful. Since
Now I am anyway discussing the porting issues, I thought I can bring up this
additional problem as well since I think the issue is the same and the fix
should be similar. On including #pdb module in the python code, I get the
following error

    
    
    traceback (most recent call last):
    File "alpha_beta", line 6, in <module>
    import pdb
    File "C:\softs\Python\Lib\pdb.py", line 14, in <module>
    File "C:\softs\Python\Lib\pprint.py", line 39, in <module>
    ImportError: No module named cStringIO 
    

I looked at the importer_Cache and looks like this

    
    
    '': None, '/usr/lib/python2.6/plat-linux2': None, '/usr/lib/python2.6/': None
    '/usr/lib/pymodules/python2.6/gtk-2.0': None, '/usr/lib/python2.6/lib-tk': None,
    '/usr/lib/python2.6/lib-old': <imp.NullImporter object at 0x7f1269048070>, '/usr/
    /python2.6/dist-packages/gtk-2.0': None, '/usr/lib/python2.6/dist-packages/PIL': None,
    '/usr/local/lib/python2.6/dist-packages': None, '/usr/lib/python2.6/dist-packages':
    None
    

* **SOLVED** : _There was a weird wrapper in the script which was causing the python script to execute from a different location. Still don't understand how though. After modifying my script to just directly execute as python myScript.py it runs fine. Thank you all anyway for the help_


Answer: The mixture of Windows and Unix style paths in your error messages makes me
think that you may have some filenames that are hard coded or manually created
using os specific path separators ('\' or '/'). If you can figure out where
the `gOptions.inputTf` and `gWorkingTfFile` values are assigned you should
look into using
[`os.path.join`](http://docs.python.org/library/os.path.html#os.path.join) to
help you use the correct paths.

    
    
    from os.path import join
    
    file = join('A', 'B')
    # 'A/B' on unix systems
    # 'A\B' on windows systems
    

