Open 0d43484e-f3c3-416f-96b8-569e24af7b04 opened 12 years ago
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).
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.
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.
I've removed Tests from the components list as I don't think it belongs there.
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.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at = None created_at =
labels = ['3.8', 'type-bug', '3.7', 'docs']
title = 'Python symlink to script behaves unexpectedly'
updated_at =
user = 'https://bugs.python.org/j13r'
```
bugs.python.org fields:
```python
activity =
actor = 'free.abdo.sh'
assignee = 'docs@python'
closed = False
closed_date = None
closer = None
components = ['Documentation']
creation =
creator = 'j13r'
dependencies = []
files = ['50098']
hgrepos = []
issue_num = 14547
keywords = []
message_count = 5.0
messages = ['158039', '158057', '158097', '221842', '395328']
nosy_count = 6.0
nosy_names = ['ncoghlan', 'eric.araujo', 'r.david.murray', 'docs@python', 'j13r', 'free.abdo.sh']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue14547'
versions = ['Python 3.6', 'Python 3.7', 'Python 3.8']
```