Title: Python symlink to script behaves unexpectedly
Type: behavior Stage: needs patch
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, eric.araujo,, j13r, ncoghlan, r.david.murray
Priority: normal Keywords:

Created on 2012-04-11 14:42 by j13r, last changed 2021-06-08 13:11 by

File name Uploaded Description Edit, 2021-06-08 13:11 the script is for a Discord bot hosted on heroku
Messages (5)
msg158039 - (view) Author: Johannes Buchner (j13r) Date: 2012-04-11 14:42
If I have a script 
  import baz

and create a symlink to it, called
ln -s foo/

when I run it, it behaves unexpectedly, specifically it behaves differently than if I had copied it here. It prefers to import baz from foo/baz, not from the current folder.

Apparently Python (2.7.2-r3) handles symlinks differently than just looking at the content (everything is a file philosophy in UNIX).
msg158057 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-04-11 17:21
The content of a symbolic symlink is a symbolic reference to another location in the file system.  If you had used a hard link it would certainly work as you expected.

The behavior with respect to symbolic links ought to be documented here:

but doesn't seem to be.
msg158097 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2012-04-12 01:31
Specifically, we end up calling os.realpath() (or the C level equivalent) when initialising __main__.__file__ and sys.path[0].

Agreed this behaviour should be documented (and tested!) explicitly.
msg221842 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-29 13:32
I've removed Tests from the components list as I don't think it belongs there.
msg395328 - (view) Author: ِAbdulrahman ِShawa ( Date: 2021-06-08 13:11
hello guys 
I am facing problem with my sqlite3 database when i make changes it saves the changes for almost 13 hours and then retakes back all the changes that i made, i am using two threads in my code and i am not committing the data but i set the isolation mode to None,
i was using the same queries with mysql database with setting autocommit to on and it was working fine what could be the problem in your opinion?
we searched and ask a lot about this issue but nothing was helpful.
Date User Action Args
2021-06-08 13:11:25free.abdo.shsetfiles: +
versions: + Python 3.6, Python 3.7, Python 3.8, - Python 2.7, Python 3.4, Python 3.5
nosy: +

messages: + msg395328

type: enhancement -> behavior
2019-03-16 00:05:00BreamoreBoysetnosy: - BreamoreBoy
2014-06-29 13:32:27BreamoreBoysetversions: + Python 3.4, Python 3.5, - Python 3.2, Python 3.3
nosy: + BreamoreBoy

messages: + msg221842

components: - Tests
2012-04-13 17:44:53eric.araujosetnosy: + eric.araujo
2012-04-12 01:31:16ncoghlansetassignee: docs@python
type: enhancement
components: + Documentation, Tests
versions: + Python 2.7, Python 3.2, Python 3.3
nosy: + docs@python

messages: + msg158097
stage: needs patch
2012-04-11 17:21:57r.david.murraysetnosy: + r.david.murray, ncoghlan
messages: + msg158057
2012-04-11 14:42:48j13rcreate