moohaad / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

Remote engine can not import modules in current directory from command line #236

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Select remote engine
2. from command line import module os and issue a os.listdir('')
3. try to import a module in the current directory

What is the expected output? What do you see instead?
Normally Python searches for a module in the current directory and then in
the pythonpath.  The remote engine fails to import modules in the current
directory, while the internal engine succeds.

What version of the product are you using? On what operating system?
Pyscripter 1.9.9.2

Please provide any additional information below.

*** Python 2.5.1 (r251:54863, May  1 2007, 17:47:05) [MSC v.1310 32 bit
(Intel)] on win32. ***
*** Remote Python engine is active ***
>>> import os
>>> os.listdir('')
['clipboard.py',
 'clipboard.pyc',
 'getoptions',
 'module1.py',
 'module1.pyc',
 'namedtuple.py',
 'namedtuple.pyc',
 'pipe_A-B.py',
 'pipe_test.py',
 'script1.pyc',
 'Tagslator 2.0',
 'Tagslator 2.0.psproj',
 'terrain.py',
 'threads_test.py',
 'updsource.py',
 'updsource.pyc']
>>> import module1
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
ImportError: No module named module1
*** Internal Python engine is active ***
>>> import module1
>>> dir(module1)
['__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 'get_table_from_db',
 'itemgetter',
 'namedtuple']
>>> 

Original issue reported on code.google.com by dghela...@gmail.com on 1 Jul 2008 at 6:45

GoogleCodeExporter commented 9 years ago
The python interpreter adds an empty string as the first item in sys.path.  
This has
the effect of searching in the current directory for modules.  To have the same
behavior do

>> import sys
>> sys.path.insert(0, "")

This in now fixed in SVN and is done automatically.

Original comment by pyscripter on 22 May 2009 at 10:59