When i do C-c C-c on a python module, it leads to *Python* buffer with Inferior Python : run Shell-Compile mode.
Suppose the correct cwd is /x/y/z/
The problem is when I print os.getcwd(), i get wrong cwd = /x/y/
Due to this, modules from the same directory can not be imported.
But when i run M-x run-python from the same module, os.getcwd() is fine and modules can be imported.
Anyone knows what is happening here ?
C-c C-c(python-shell-send-buffer) sends code to the existing buffer. So I guess you'd already created a buffer in that other directory. What do you want to do? Change the directory of the existing buffer (which may have been used for different, even incompatible stuff)? Have separate Python buffers for each file? for each directory?C-c C-cinterprets the code but can not import any modules from the same directory.os.getcwd()in the same interpreter buffer gives wrong directory - this is why the modules from same directory could not be imported. Now i kill this*Python*buffer and runM-x run-python. Nowos.getcwd()runs just fine. RunningC-c C-calso interprets and imports all modules since cwd is correct now. Why this cwd difference betweenC-c C-candM-x run-python?C-c C-csends code to the existing buffer. If the existing buffer was created from a file in a different directory, the existing buffer is in that different directory. If the existing buffer was created from a file in the same directory, the existing buffer is in the same directory.*Python*buffer doesn't exist.C-c C-cis run on a file in a directory/x/y/z/.os.getcwd()in this buffer returns/x/y/instead of/x/y/z/. Killing this*Python*buffer, creating the new*Python*buffer withM-x run-pythonfrom the same file same directory andos.getcwd()returns correct/x/y/z/now and modules from the same directory are getting imported. Wasn'tC-c C-calso supposed to do the same thing and import the modules from the same directory ?Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native-enable’ was t and "python" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list. Native completions have been disabled locally.Also i am getting this warning when i runC-c C-con my python code.