I want to import some files/modules from other directory. I have placed an init.py in the directory but still not able to import the files/modules. I am using Pycharm 2019.  I want to use init.py only method and not the sys.path.append.  thanks in Advance!
7325
How can I load a Python module given its full path? Note that the file can be anywhere in the filesystem, as it is a configuration option.
97732
I have a directory with several subdirectories with files. How can I copy all files in the subdirectories to a new location?  Edit: I do not want to copy the directories, just the files...  As this is still on XP, I chose the below solution:   for /D %S IN ("src\*.*") DO  @COPY "%S\" "dest\"   Thanks!
81242
I have a directory structure like the following;     script.php      inc/include1.php   inc/include2.php      objects/object1.php   objects/object2.php      soap/soap.php   Now, I use those objects in both script.php and /soap/soap.php, I could move them, but I want the directory structure like that for a specific reason. When executing script.php the include path is inc/include.php and when executing /soap/soap.php it's ../inc, absolute paths work, /mnt/webdev/[project name]/inc/include1.php... But it's an ugly solution if I ever want to move the directory to a different location.  So is there a way to use relative paths, or a way to programmatically generate the "/mnt/webdev/[project name]/"?
3912
I want to detect whether module has changed. Now, using inotify is simple, you just need to know the directory you want to get notifications from.  How do I retrieve a module's path in python?
23941
I have been using Python more and more, and I keep seeing the variable __all__ set in different __init__.py files.  Can someone explain what this does?
83605
In blender, Import has no .blend option..so how can I import .blend file in my current blend file?
34127
I have multiple files in multiple folders under one directory that need to be in one folder. Is there a command line that can help me accomplish this?
6666
I've read that it is possible to add a method to an existing object (i.e., not in the class definition) in Python.   I understand that it's not always good to do so. But how might one do this?
52452
Functions such as os.path.exists(image.filepath) fail when Blender uses relative paths, This seems to be because Blender uses // prefix for relative paths, unlike the more conventional ./.  How can standard Python filesystem functions be used correctly on Blender paths?
18253
First of all, I'm using Python 2.7.3, QGIS 1.8 (Lisboa) on Windows 7 pro 64 bits.  Now let's go to the actual question:  I have written some code (Python) that works well within the QGIS built in Python console, but now I need to run it from outside QGIS (it is too much to ask for the final user to open QGIS, then the python console and to copy and paste the code).  I have been trying to access the QGIS API, but it is missing from my PYTHONPATH. I've tried whatever is on the instructions, plus a bunch of paths like:  C:\Program Files(x86)\QGIS\apps\qgis\python\qgis and  C:\Program Files(x86)\QGIS\apps\qgis\python. My result so far is always the same:  import qgis.core ImportError: No module named qgis.core   Any ideas?
25532
I have to work with .dng files and it looks like you can do it in Blender, somehow.   As stated in , it seems that you can import them but I don't know how; how do I do this?
32948
I have a function that resembles the one below. I'm not sure how to use the os module to get back to my original working directory at the conclusion of the jar's execution.   def run():      owd = os.getcwd()     #first change dir to build_dir path     os.chdir(testDir)     #run jar from test directory     os.system(cmd)     #change dir back to original working directory (owd)   note: I think my code formatting is off - not sure why. My apologies in advance
4439
If a large module is loaded by some submodule of your code, is there any benefit to referencing the module from that namespace instead of importing it again?  For example: I have a module MyLib, which makes extensive use of ReallyBigLib. If I have code that imports MyLib, should I dig the module out like so  import MyLib ReallyBigLib = MyLib.SomeModule.ReallyBigLib   or just  import MyLib import ReallyBigLib
72629
Let's say the directory ~/this_dir doesn't exist.  I need to be able to run touch ~/this_dir/new.txt to create new.txt in ~/this_dir.  Is there a simple way to make touch also create the directory?  Or an alternative command which would achieve the same thing?  Thanks
14808
I have a module in the parent directory of my script and I would like to 'use' it.  If I do  use '../Foo.pm';   I get syntax errors.  I tried to do:  push @INC, '..'; use EPMS;   and .. apparently doesn't show up in @INC  I'm going crazy!  What's wrong here?
100109
&gt;&gt;&gt; import arcpy Traceback (most recent call last):   File "&lt;interactive input&gt;", line 1, in &lt;module&gt;   File "C:\Python27\lib\arcpy\__init__.py", line 21, in &lt;module&gt;     from arcpy.geoprocessing import gp   File "C:\Python27\lib\arcpy\geoprocessing\__init__.py", line 14, in &lt;module&gt;     from _base import *   File "C:\Python27\lib\arcpy\geoprocessing\_base.py", line 14, in &lt;module&gt;     import arcgisscripting ImportError: DLL load failed: The specified module could not be found.   This is the error I get when i try to import arcpy. Any suggestions?
105352
I want to be able to run Python commands from the Windows CMD. However, if I don't specify Python's full path for each command, I get an error saying "Python is not recognized as an internal or external command, operable program or batch file."  How do I add Python to the Windows PATH permanently?