This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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

Created on 2012-04-11 14:42 by j13r, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
main.py free.abdo.sh, 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 
foo/bar.py
  import baz

and create a symlink to it, called barhere.py
ln -s foo/bar.py barhere.py

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:

  http://docs.python.org/using/cmdline.html

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 (free.abdo.sh) 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.
History
Date User Action Args
2022-04-11 14:57:29adminsetgithub: 58752
2021-06-08 13:11:25free.abdo.shsetfiles: + main.py
versions: + Python 3.6, Python 3.7, Python 3.8, - Python 2.7, Python 3.4, Python 3.5
nosy: + free.abdo.sh

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