Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9233071
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:27:55+00:00 2026-06-18T06:27:55+00:00

I am writing a fabric file that which will take a dataset, send it

  • 0

I am writing a fabric file that which will take a dataset, send it to a server, run an analysis script on it, and retrieve the results. If I hardcode the location of my script, process_script, I am all good. However, I would like to include the script as a file in a module and would therefore like to be able to access that file without hardcoding the location. Can I do it using the import system? I’m not sure. Here’s a working version of what I’d like to do:

#data, script
datafile       = 'data.txt' 
process_script = 'process.py'

#simple function    
def upload_and_run():
    newdir = remote_dir + '/process_temp'
    put(datafile, newdir)
    put(process_script, newdir)
    with cd(newdir):
        run('python2.6 process.py {0}'.format(datafile))
    get(newdir,'%(path)s')

#pseudocode of how I'd like to access the process_script
process_script = from module import script
put(process_script, newdir)

any suggestions are appreciated,
thanks,
zach cp

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:27:56+00:00Added an answer on June 18, 2026 at 6:27 am

    as per this and this, I can access the module path using the .__file__ attribute of the module. The script is then hardcoded with that path.

    import os
    path = os.path.dirname(my_module.__file__)
    process_script = path+ 'process.py'
    put(process_script)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing an application in Cocoa that will take input from the user, format it
Writing a script that cds into another dir, loads the correct rvm rvmrc file,
Writing a client application that sends images to a server via a webservice. As
Writing an app that will include the ability to decompress zip and rar files.
Writing a simple program that will find exact duplicate files on my computer, but
Writing some docs with code snippets which I want to be copyable to run
writing a server that runs on linux (Ubuntu) using mono. and a client that
Writing a stored procedure that will have multiple input parameters. The parameters may not
Writing htaccess that allows me to remove index.php from the URL can confuse search
Writing documentation in html requires some code examples. What to do with characters that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.